Class

io.scalajs.dom.html.phaser

InputHandler

Related Doc: package phaser

Permalink

class InputHandler extends Object

The Input Handler is bound to a specific Sprite and is responsible for managing all Input events on that Sprite.

Annotations
@RawJSType() @native()
See also

http://phaser.io/docs/2.6.2/Phaser.InputHandler.html

Linear Supertypes
Object, Any, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. InputHandler
  2. Object
  3. Any
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new InputHandler(sprite: Phaser.Sprite)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. var allowHorizontalDrag: Boolean

    Permalink

    Controls if the Sprite is allowed to be dragged horizontally.

  5. var allowVerticalDrag: Boolean

    Permalink

    Controls if the Sprite is allowed to be dragged vertically.

  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. var boundsRect: Phaser.Rectangle

    Permalink

    A region of the game world within which the sprite is restricted during drag.

  8. var boundsSprite: Phaser.Sprite

    Permalink

    A Sprite the bounds of which this sprite is restricted during drag.

  9. var bringToTop: Boolean

    Permalink

    If true when this Sprite is clicked or dragged it will automatically be bought to the top of the Group it is within.

  10. def checkBoundsRect(): Unit

    Permalink

    Bounds Rect check for the sprite drag

  11. def checkBoundsSprite(): Unit

    Permalink

    Parent Sprite Bounds check for the sprite drag.

  12. def checkPixel(x: Double, y: Double, pointer: Phaser.Pointer = js.native): Boolean

    Permalink

    Runs a pixel perfect check against the given x/y coordinates of the Sprite this InputHandler is bound to.

    Runs a pixel perfect check against the given x/y coordinates of the Sprite this InputHandler is bound to. It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectAlpha it returns true.

    x

    The x coordinate to check.

    y

    The y coordinate to check.

    pointer

    The pointer to get the x/y coordinate from if not passed as the first two parameters.

    returns

    true if there is the alpha of the pixel is >= InputHandler.pixelPerfectAlpha

  13. def checkPointerDown(pointer: Phaser.Pointer, fastTest: Boolean = js.native): Boolean

    Permalink

    Checks if the given pointer is both down and over the Sprite this InputHandler belongs to.

    Checks if the given pointer is both down and over the Sprite this InputHandler belongs to. Use the fastTest flag is to quickly check just the bounding hit area even if InputHandler.pixelPerfectOver is true.

    pointer

    the pointer

    fastTest

    Force a simple hit area check even if pixelPerfectOver is true for this object?

    returns

    True if the pointer is down, otherwise false.

  14. def checkPointerOver(pointer: Phaser.Pointer, fastTest: Boolean = js.native): Boolean

    Permalink

    Checks if the given pointer is over the Sprite this InputHandler belongs to.

    Checks if the given pointer is over the Sprite this InputHandler belongs to. Use the fastTest flag is to quickly check just the bounding hit area even if InputHandler.pixelPerfectOver is true.

    pointer

    the pointer

    fastTest

    Force a simple hit area check even if pixelPerfectOver is true for this object?

    returns

    true or false

  15. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  16. def destroy(): Unit

    Permalink

    Clean up memory.

  17. def disableDrag(): Unit

    Permalink

    Stops this sprite from being able to be dragged.

    Stops this sprite from being able to be dragged. If it is currently the target of an active drag it will be stopped immediately; also disables any set callbacks.

  18. def disableSnap(): Unit

    Permalink

    Stops the sprite from snapping to a grid during drag or release.

  19. def downDuration(pointerId: Int = js.native): Double

    Permalink

    If the pointer is currently over this Sprite this returns how long it has been there for in milliseconds.

    If the pointer is currently over this Sprite this returns how long it has been there for in milliseconds.

    pointerId

    the optional pointer ID

    returns

    The number of milliseconds the pointer has been pressed down on the Sprite, or -1 if not over.

  20. var downPoint: Phaser.Point

    Permalink

    A Point object containing the coordinates of the Pointer when it was first pressed down onto this Sprite.

  21. var dragDistanceThreshold: Int

    Permalink

    The distance, in pixels, the pointer has to move while being held down, before the Sprite thinks it is being dragged.

  22. var dragFromCenter: Boolean

    Permalink

    Is the Sprite dragged from its center, or the point at which the Pointer was pressed down upon it?

  23. var dragOffset: Phaser.Point

    Permalink

    The offset from the Sprites position that dragging takes place from.

  24. var dragStartPoint: Phaser.Point

    Permalink

    The Point from which the most recent drag started from.

    The Point from which the most recent drag started from. Useful if you need to return an object to its starting position.

  25. var dragStopBlocksInputUp: Boolean

    Permalink

    If enabled, when the Sprite stops being dragged, it will only dispatch the onDragStop event, and not the onInputUp event.

    If enabled, when the Sprite stops being dragged, it will only dispatch the onDragStop event, and not the onInputUp event. If set to false it will dispatch both events.

  26. var dragTimeThreshold: Int

    Permalink

    The amount of time, in ms, the pointer has to be held down over the Sprite before it thinks it is being dragged.

  27. var draggable: Boolean

    Permalink

    Is this sprite allowed to be dragged by the mouse? true = yes, false = no

  28. def enableDrag(lockCenter: Boolean = js.native, bringToTop: Boolean = js.native, pixelPerfect: Boolean = js.native, alphaThreshold: Boolean = js.native, boundsRect: Phaser.Rectangle = js.native, boundsSprite: Phaser.Sprite = js.native): Unit

    Permalink

    Allow this Sprite to be dragged by any valid pointer.

    Allow this Sprite to be dragged by any valid pointer. When the drag begins the Sprite.events.onDragStart event will be dispatched. When the drag completes by way of the user letting go of the pointer that was dragging the sprite, the Sprite.events.onDragStop event is dispatched.

    You can control the thresholds over when a drag starts via the properties: Pointer.dragDistanceThreshold the distance, in pixels, that the pointer has to move before the drag will start. Pointer.dragTimeThreshold the time, in ms, that the pointer must be held down on the Sprite before the drag will start. You can set either (or both) of these properties after enabling a Sprite for drag. For the duration of the drag the Sprite.events.onDragUpdate event is dispatched. This event is only dispatched when the pointer actually changes position and moves. The event sends 5 parameters: sprite, pointer, dragX, dragY and snapPoint.

    lockCenter

    If false the Sprite will drag from where you click it minus the dragOffset. If true it will center itself to the tip of the mouse pointer.

    bringToTop

    If true the Sprite will be bought to the top of the rendering list in its current Group.

    pixelPerfect

    If true it will use a pixel perfect test to see if you clicked the Sprite. False uses the bounding box.

    alphaThreshold

    If using pixel perfect collision this specifies the alpha level from 0 to 255 above which a collision is processed.

    boundsRect

    If you want to restrict the drag of this sprite to a specific Rectangle, pass the Phaser.Rectangle here, otherwise it's free to drag anywhere.

    boundsSprite

    If you want to restrict the drag of this sprite to within the bounding box of another sprite, pass it here.

  29. def enableSnap(snapX: Double, snapY: Double, onDrag: Boolean = js.native, onRelease: Boolean = js.native, snapOffsetX: Double = js.native, snapOffsetY: Double = js.native): Unit

    Permalink

    Make this Sprite snap to the given grid either during drag or when it's released.

    Make this Sprite snap to the given grid either during drag or when it's released. For example 16x16 as the snapX and snapY would make the sprite snap to every 16 pixels.

    snapX

    The width of the grid cell to snap to.

    snapY

    The height of the grid cell to snap to.

    onDrag

    If true the sprite will snap to the grid while being dragged.

    onRelease

    If true the sprite will snap to the grid when released.

    snapOffsetX

    Used to offset the top-left starting point of the snap grid.

    snapOffsetY

    Used to offset the top-left starting point of the snap grid.

  30. var enabled: Boolean

    Permalink

    If enabled the Input Handler will process input requests and monitor pointer activity.

  31. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  32. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  33. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  34. var game: Phaser.Game

    Permalink

    A reference to the currently running game.

  35. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  36. def globalToLocalX(x: Double): Unit

    Permalink

    Warning: EXPERIMENTAL

    Warning: EXPERIMENTAL

    x

    TODO

  37. def hasOwnProperty(v: String): Boolean

    Permalink
    Definition Classes
    Object
  38. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  39. var isDragged: Boolean

    Permalink

    Returns true if the Sprite is being currently dragged.

  40. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  41. def isPixelPerfect(): Boolean

    Permalink

    Is this object using pixel perfect checking?

    Is this object using pixel perfect checking?

    returns

    True if the this InputHandler has either pixelPerfectClick or pixelPerfectOver set to true.

  42. def isPrototypeOf(v: Object): Boolean

    Permalink
    Definition Classes
    Object
  43. def justOut(pointerId: Int, delay: Double): Boolean

    Permalink

    Returns true if the pointer has left the Sprite within the specified delay time (defaults to 500ms, half a second)

    Returns true if the pointer has left the Sprite within the specified delay time (defaults to 500ms, half a second)

    pointerId

    the given pointer ID

    delay

    The time below which the pointer is considered as just out.

    returns

    true or false

  44. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  45. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  46. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  47. var pixelPerfectAlpha: Int

    Permalink

    The alpha tolerance threshold.

    The alpha tolerance threshold. If the alpha value of the pixel matches or is above this value, it's considered a hit.

  48. var pixelPerfectClick: Boolean

    Permalink

    Set to true to use pixel perfect hit detection when checking if the pointer is over this Sprite when it's clicked or touched.

    Set to true to use pixel perfect hit detection when checking if the pointer is over this Sprite when it's clicked or touched. The x/y coordinates of the pointer are tested against the image in combination with the InputHandler.pixelPerfectAlpha value. This feature only works for display objects with image based textures such as Sprites. It won't work on BitmapText or Rope.

    Warning: This is expensive so only enable if you really need it. Use a pixel perfect check when testing for clicks or touches on the Sprite.

  49. var pixelPerfectOver: Boolean

    Permalink

    Set to true to use pixel perfect hit detection when checking if the pointer is over this Sprite.

    Set to true to use pixel perfect hit detection when checking if the pointer is over this Sprite. The x/y coordinates of the pointer are tested against the image in combination with the InputHandler.pixelPerfectAlpha value. This feature only works for display objects with image based textures such as Sprites. It won't work on BitmapText or Rope.

    Warning: This is expensive, especially on mobile (where it's not even needed!) so only enable if required. Also see the less-expensive InputHandler.pixelPerfectClick. Use a pixel perfect check when testing for pointer over.

  50. var priorityID: Int

    Permalink

    The priorityID is used to determine which game objects should get priority when input events occur.

    The priorityID is used to determine which game objects should get priority when input events occur. For example if you have several Sprites that overlap, by default the one at the top of the display list is given priority for input events. You can stop this from happening by controlling the priorityID value. The higher the value, the more important they are considered to the Input events.

  51. def propertyIsEnumerable(v: String): Boolean

    Permalink
    Definition Classes
    Object
  52. var scaleLayer: Boolean

    Permalink

    EXPERIMENTAL: Please do not use this property unless you know what it does.

    EXPERIMENTAL: Please do not use this property unless you know what it does. Likely to change in the future.

  53. var snapOffset: Phaser.Point

    Permalink

    A Point object that contains by how far the Sprite snap is offset.

  54. var snapOffsetX: Int

    Permalink

    This defines the top-left X coordinate of the snap grid.

  55. var snapOffsetY: Int

    Permalink

    This defines the top-left Y coordinate of the snap grid.

  56. var snapOnDrag: Boolean

    Permalink

    When the Sprite is dragged this controls if the center of the Sprite will snap to the pointer on drag or not.

  57. var snapOnRelease: Boolean

    Permalink

    When the Sprite is dragged this controls if the Sprite will be snapped on release.

  58. var snapPoint: Phaser.Point

    Permalink

    If the sprite is set to snap while dragging this holds the point of the most recent 'snap' event.

  59. var snapX: Int

    Permalink

    When a Sprite has snapping enabled this holds the width of the snap grid.

  60. var snapY: Int

    Permalink

    When a Sprite has snapping enabled this holds the height of the snap grid.

  61. val sprite: Phaser.Sprite

    Permalink
  62. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  63. def toLocaleString(): String

    Permalink
    Definition Classes
    Object
  64. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  65. var useHandCursor: Boolean

    Permalink

    On a desktop browser you can set the 'hand' cursor to appear when moving over the Sprite.

  66. def valueOf(): Any

    Permalink
    Definition Classes
    Object
  67. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  68. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  69. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped