@@ -265,7 +265,7 @@ UI.prototype = {
265
265
hide : function ( ) {
266
266
this . elements . forEach ( function ( element ) { element . visible = false } ) ;
267
267
this . scene . switchmode ( "normal" ) ;
268
- this . translate ( 0 , 800 , 400 , this . scene . unfreeze ) ;
268
+ this . translate ( 0 , this . scene . cameras . main . height , 400 , this . scene . unfreeze ) ;
269
269
} ,
270
270
show : function ( ) {
271
271
this . elements . forEach ( function ( element ) { element . visible = true } ) ;
@@ -278,10 +278,9 @@ UI.prototype = {
278
278
scrollX : x ,
279
279
scrollY : y ,
280
280
duration : speed ,
281
- ease : "Cubic.easeOut" ,
282
- onComplete : callback ,
283
- onCompleteParams : [ this . scene ]
281
+ ease : "Cubic.easeOut"
284
282
} ) ;
283
+ this . scene . time . delayedCall ( speed , callback , [ ] , this . scene ) ;
285
284
} ,
286
285
update : function ( ) {
287
286
this . elements . forEach ( function ( element ) { element . update ( ) } ) ;
@@ -510,6 +509,8 @@ Scene.prototype = {
510
509
511
510
this . events . emit ( 'switchmode' , this . mode ) ;
512
511
512
+ this . W = this . cameras . main . width ;
513
+ this . H = this . cameras . main . height ;
513
514
this . drawmode = "CubicBezier" ;
514
515
515
516
//TODO: seperate class
@@ -542,9 +543,13 @@ Scene.prototype = {
542
543
this . clearbutton = this . middle . add . text ( 10 , 100 , 'clear' , null , null , null , this . clear , [ ] , this ) ;
543
544
this . undobutton = this . middle . add . text ( 10 , 50 , 'undo' , null , null , null , this . undo , [ ] , this ) ;
544
545
545
- this . importbutton = this . middle . add . text ( 700 , 400 , 'import' , null , null , null , this . import , [ ] , this ) ;
546
- this . exportbutton = this . middle . add . text ( 700 , 500 , 'export' , null , null , null , this . export , [ ] , this ) ;
547
- this . previewbutton = this . middle . add . text ( 10 , 500 , 'preview' , null , null , null , this . preview , [ ] , this ) ;
546
+ this . importbutton = this . middle . add . text ( this . W - 100 , this . H - 200 , 'import' , null , null , null , this . import , [ ] , this ) ;
547
+ this . exportbutton = this . middle . add . text ( this . W - 100 , this . H - 100 , 'export' , null , null , null , this . export , [ ] , this ) ;
548
+
549
+ this . pausebutton = this . middle . add . text ( 10 , this . H - 200 , 'pause' , null , null , null , this . freeze , [ ] , this ) ;
550
+ this . resumebutton = this . middle . add . text ( 10 , this . H - 150 , 'resume' , null , null , null , this . unfreeze , [ ] , this ) ;
551
+
552
+ this . previewbutton = this . middle . add . text ( 10 , this . H - 100 , 'preview' , null , null , null , this . preview , [ ] , this ) ;
548
553
549
554
this . modelabel = this . middle . add . label ( 100 , 20 , 'mode: ' , null , null , null , null , this ) ;
550
555
this . drawmodelabel = this . middle . add . label ( 400 , 20 , 'curve: ' + this . drawmode , null , null , null , null , this ) ;
@@ -573,7 +578,6 @@ Scene.prototype = {
573
578
//this.cameras.main.setZoom(Math.sin(this.time.now/100000)+1);
574
579
//this.middle.camera.setZoom(Math.sin(this.time.now/100000)+1);
575
580
//this.top.camera.setZoom(Math.sin(this.time.now/100000)+1);
576
-
577
581
} ,
578
582
setCameras : function ( ) {
579
583
this . drawpanel . camera . ignore ( this . middle . elements ) ;
@@ -772,12 +776,11 @@ Scene.prototype = {
772
776
this . graphics . fillStyle ( 0xffffff , 1 ) ;
773
777
this . path . draw ( this . graphics , this . path . segments ) ;
774
778
} ,
775
- freeze : function ( tw , s , ui ) {
776
- //TODO:rewrite
777
- ui . scene . manager . scenes [ 0 ] . scene . pause ( ) ;
779
+ freeze : function ( ) {
780
+ this . scene . manager . scenes [ 0 ] . scene . pause ( ) ;
778
781
} ,
779
- unfreeze : function ( tw , s , ui ) {
780
- ui . scene . manager . scenes [ 0 ] . scene . resume ( ) ;
782
+ unfreeze : function ( ) {
783
+ this . scene . manager . scenes [ 0 ] . scene . resume ( ) ;
781
784
} ,
782
785
import : function ( ) {
783
786
var data = this . cache . json . get ( 'data' ) ;
@@ -838,7 +841,7 @@ var Pointer = function (ui, x, y, key, frame) {
838
841
this . scene . input . on ( 'pointerdown' , function ( pointer , gameObject ) {
839
842
840
843
if ( this . scene . mode == "draw" && pointer . dragState == 0 ) {
841
- if ( gameObject . length == 0 && ( pointer . x > 50 && pointer . x < 700 ) ) {
844
+ if ( gameObject . length == 0 && ( pointer . x > 50 && pointer . x < this . scene . W - 100 ) ) {
842
845
this . scene . place ( this . scene . drawpanel , this . x , this . y ) ;
843
846
}
844
847
}
0 commit comments