6
6
7
7
/**
8
8
* The Input Handler is bound to a specific Sprite and is responsible for managing all Input events on that Sprite.
9
- *
9
+ *
10
10
* @class Phaser.InputHandler
11
11
* @constructor
12
12
* @param {Phaser.Sprite } sprite - The Sprite object to which this Input Handler belongs.
@@ -455,7 +455,7 @@ Phaser.InputHandler.prototype = {
455
455
/**
456
456
* The x coordinate of the Input pointer, relative to the top-left of the parent Sprite.
457
457
* This value is only set when the pointer is over this Sprite.
458
- *
458
+ *
459
459
* @method Phaser.InputHandler#pointerX
460
460
* @param {number } pointer - The index of the pointer to check. You can get this from Phaser.Pointer.id.
461
461
* @return {number } The x coordinate of the Input pointer.
@@ -471,7 +471,7 @@ Phaser.InputHandler.prototype = {
471
471
/**
472
472
* The y coordinate of the Input pointer, relative to the top-left of the parent Sprite
473
473
* This value is only set when the pointer is over this Sprite.
474
- *
474
+ *
475
475
* @method Phaser.InputHandler#pointerY
476
476
* @param {number } pointer - The index of the pointer to check. You can get this from Phaser.Pointer.id.
477
477
* @return {number } The y coordinate of the Input pointer.
@@ -486,7 +486,7 @@ Phaser.InputHandler.prototype = {
486
486
487
487
/**
488
488
* If the Pointer is down this returns true. Please note that it only checks if the Pointer is down, not if it's down over any specific Sprite.
489
- *
489
+ *
490
490
* @method Phaser.InputHandler#pointerDown
491
491
* @param {number } pointer - The index of the pointer to check. You can get this from Phaser.Pointer.id.
492
492
* @return {boolean } - True if the given pointer is down, otherwise false.
@@ -501,7 +501,7 @@ Phaser.InputHandler.prototype = {
501
501
502
502
/**
503
503
* If the Pointer is up this returns true. Please note that it only checks if the Pointer is up, not if it's up over any specific Sprite.
504
- *
504
+ *
505
505
* @method Phaser.InputHandler#pointerUp
506
506
* @param {number } pointer - The index of the pointer to check. You can get this from Phaser.Pointer.id.
507
507
* @return {boolean } - True if the given pointer is up, otherwise false.
@@ -516,7 +516,7 @@ Phaser.InputHandler.prototype = {
516
516
517
517
/**
518
518
* A timestamp representing when the Pointer first touched the touchscreen.
519
- *
519
+ *
520
520
* @method Phaser.InputHandler#pointerTimeDown
521
521
* @param {number } pointer - The index of the pointer to check. You can get this from Phaser.Pointer.id.
522
522
* @return {number }
@@ -545,7 +545,7 @@ Phaser.InputHandler.prototype = {
545
545
546
546
/**
547
547
* Is the Pointer over this Sprite?
548
- *
548
+ *
549
549
* @method Phaser.InputHandler#pointerOver
550
550
* @param {number } [index] - The ID number of a Pointer to check. If you don't provide a number it will check all Pointers.
551
551
* @return {boolean } - True if the given pointer (if a index was given, or any pointer if not) is over this object.
@@ -649,7 +649,7 @@ Phaser.InputHandler.prototype = {
649
649
/**
650
650
* Checks if the given pointer is both down and over the Sprite this InputHandler belongs to.
651
651
* Use the `fastTest` flag is to quickly check just the bounding hit area even if `InputHandler.pixelPerfectOver` is `true`.
652
- *
652
+ *
653
653
* @method Phaser.InputHandler#checkPointerDown
654
654
* @param {Phaser.Pointer } pointer
655
655
* @param {boolean } [fastTest=false] - Force a simple hit area check even if `pixelPerfectOver` is true for this object?
@@ -684,7 +684,7 @@ Phaser.InputHandler.prototype = {
684
684
/**
685
685
* Checks if the given pointer is over the Sprite this InputHandler belongs to.
686
686
* Use the `fastTest` flag is to quickly check just the bounding hit area even if `InputHandler.pixelPerfectOver` is `true`.
687
- *
687
+ *
688
688
* @method Phaser.InputHandler#checkPointerOver
689
689
* @param {Phaser.Pointer } pointer
690
690
* @param {boolean } [fastTest=false] - Force a simple hit area check even if `pixelPerfectOver` is true for this object?
@@ -915,7 +915,7 @@ Phaser.InputHandler.prototype = {
915
915
this . _pointerData [ pointer . id ] . isDown = true ;
916
916
this . _pointerData [ pointer . id ] . isUp = false ;
917
917
this . _pointerData [ pointer . id ] . timeDown = this . game . time . now ;
918
-
918
+
919
919
if ( this . sprite && this . sprite . events )
920
920
{
921
921
this . sprite . events . onInputDown . dispatch ( this . sprite , pointer ) ;
@@ -1192,12 +1192,12 @@ Phaser.InputHandler.prototype = {
1192
1192
*/
1193
1193
enableDrag : function ( lockCenter , bringToTop , pixelPerfect , alphaThreshold , boundsRect , boundsSprite ) {
1194
1194
1195
- if ( typeof lockCenter == 'undefined' ) { lockCenter = false ; }
1196
- if ( typeof bringToTop == 'undefined' ) { bringToTop = false ; }
1197
- if ( typeof pixelPerfect == 'undefined' ) { pixelPerfect = false ; }
1198
- if ( typeof alphaThreshold == 'undefined' ) { alphaThreshold = 255 ; }
1199
- if ( typeof boundsRect == 'undefined' ) { boundsRect = null ; }
1200
- if ( typeof boundsSprite == 'undefined' ) { boundsSprite = null ; }
1195
+ if ( typeof lockCenter === 'undefined' ) { lockCenter = false ; }
1196
+ if ( typeof bringToTop === 'undefined' ) { bringToTop = false ; }
1197
+ if ( typeof pixelPerfect === 'undefined' ) { pixelPerfect = false ; }
1198
+ if ( typeof alphaThreshold === 'undefined' ) { alphaThreshold = 255 ; }
1199
+ if ( typeof boundsRect === 'undefined' ) { boundsRect = null ; }
1200
+ if ( typeof boundsSprite === 'undefined' ) { boundsSprite = null ; }
1201
1201
1202
1202
this . _dragPoint = new Phaser . Point ( ) ;
1203
1203
this . draggable = true ;
@@ -1272,7 +1272,7 @@ Phaser.InputHandler.prototype = {
1272
1272
this . sprite . x = this . globalToLocalX ( pointer . x ) + ( this . sprite . x - bounds . centerX ) ;
1273
1273
this . sprite . y = this . globalToLocalY ( pointer . y ) + ( this . sprite . y - bounds . centerY ) ;
1274
1274
}
1275
-
1275
+
1276
1276
this . _dragPoint . setTo ( this . sprite . x - this . globalToLocalX ( pointer . x ) , this . sprite . y - this . globalToLocalY ( pointer . y ) ) ;
1277
1277
}
1278
1278
@@ -1365,8 +1365,8 @@ Phaser.InputHandler.prototype = {
1365
1365
*/
1366
1366
setDragLock : function ( allowHorizontal , allowVertical ) {
1367
1367
1368
- if ( typeof allowHorizontal == 'undefined' ) { allowHorizontal = true ; }
1369
- if ( typeof allowVertical == 'undefined' ) { allowVertical = true ; }
1368
+ if ( typeof allowHorizontal === 'undefined' ) { allowHorizontal = true ; }
1369
+ if ( typeof allowVertical === 'undefined' ) { allowVertical = true ; }
1370
1370
1371
1371
this . allowHorizontalDrag = allowHorizontal ;
1372
1372
this . allowVerticalDrag = allowVertical ;
@@ -1386,10 +1386,10 @@ Phaser.InputHandler.prototype = {
1386
1386
*/
1387
1387
enableSnap : function ( snapX , snapY , onDrag , onRelease , snapOffsetX , snapOffsetY ) {
1388
1388
1389
- if ( typeof onDrag == 'undefined' ) { onDrag = true ; }
1390
- if ( typeof onRelease == 'undefined' ) { onRelease = false ; }
1391
- if ( typeof snapOffsetX == 'undefined' ) { snapOffsetX = 0 ; }
1392
- if ( typeof snapOffsetY == 'undefined' ) { snapOffsetY = 0 ; }
1389
+ if ( typeof onDrag === 'undefined' ) { onDrag = true ; }
1390
+ if ( typeof onRelease === 'undefined' ) { onRelease = false ; }
1391
+ if ( typeof snapOffsetX === 'undefined' ) { snapOffsetX = 0 ; }
1392
+ if ( typeof snapOffsetY === 'undefined' ) { snapOffsetY = 0 ; }
1393
1393
1394
1394
this . snapX = snapX ;
1395
1395
this . snapY = snapY ;
0 commit comments