Skip to main content
Version: Phaser v4.0.0-rc.6

Types.Input

EventData

<static> EventData

A Phaser Input Event Data object.

This object is passed to the registered event listeners and allows you to stop any further propagation.

nametypeoptionaldefaultdescription
cancelledbooleanYesfalseThe cancelled state of this Event.
stopPropagationfunctionNoCall this method to stop this event from passing any further down the event chain.

Type: object

Member of: Phaser.Types.Input

Source: src/input/typedefs/EventData.js#L7
Since: 3.15.1


HitAreaCallback

<static> HitAreaCallback

Type: function

Member of: Phaser.Types.Input

Source: src/input/typedefs/HitAreaCallback.js#L1
Since: 3.0.0


InputConfiguration

<static> InputConfiguration

nametypeoptionaldefaultdescription
hitAreaanyYesThe object / shape to use as the Hit Area. If not given it will try to create a Rectangle based on the texture frame.
hitAreaCallbackPhaser.Types.Input.HitAreaCallbackYesThe callback that determines if the pointer is within the Hit Area shape or not.
draggablebooleanYesfalseIf true the Interactive Object will be set to be draggable and emit drag events.
dropZonebooleanYesfalseIf true the Interactive Object will be set to be a drop zone for draggable objects.
useHandCursorbooleanYesfalseIf true the Interactive Object will set the pointer hand cursor when a pointer is over it. This is a short-cut for setting cursor: 'pointer'.
cursorstringYesThe CSS string to be used when the cursor is over this Interactive Object.
pixelPerfectbooleanYesfalseIf true the a pixel perfect function will be set for the hit area callback. Only works with image texture based Game Objects, not Render Textures.
alphaTolerancenumberYes1If pixelPerfect is set, this is the alpha tolerance threshold value used in the callback. A value of 255 will match only fully opaque pixels.

Type: object

Member of: Phaser.Types.Input

Source: src/input/typedefs/InputConfiguration.js#L1
Since: 3.0.0


InputPluginContainer

<static> InputPluginContainer

nametypeoptionaldescription
keystringNoThe unique name of this plugin in the input plugin cache.
pluginfunctionNoThe plugin to be stored. Should be the source object, not instantiated.
mappingstringYesIf this plugin is to be injected into the Input Plugin, this is the property key map used.

Type: object

Member of: Phaser.Types.Input

Source: src/input/typedefs/InputPluginContainer.js#L1
Since: 3.0.0


InteractiveObject

<static> InteractiveObject

nametypeoptionaldescription
gameObjectPhaser.GameObjects.GameObjectNoThe Game Object to which this Interactive Object is bound.
enabledbooleanNoIs this Interactive Object currently enabled for input events?
draggablebooleanNoIs this Interactive Object draggable? Enable with InputPlugin.setDraggable.
dropZonebooleanNoIs this Interactive Object a drag-targets drop zone? Set when the object is created.
cursorboolean | stringNoShould this Interactive Object change the cursor (via css) when over? (desktop only)
targetPhaser.GameObjects.GameObjectNoAn optional drop target for a draggable Interactive Object.
cameraPhaser.Cameras.Scene2D.CameraNoThe most recent Camera to be tested against this Interactive Object.
hitAreaanyNoThe hit area for this Interactive Object. Typically a geometry shape, like a Rectangle or Circle.
hitAreaCallbackPhaser.Types.Input.HitAreaCallbackNoThe 'contains' check callback that the hit area shape will use for all hit tests.
hitAreaDebugPhaser.GameObjects.ShapeNoIf this Interactive Object has been enabled for debug, via InputPlugin.enableDebug then this property holds its debug shape.
customHitAreabooleanNoWas the hitArea for this Interactive Object created based on texture size (false), or a custom shape? (true)
localXnumberNoThe x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position.
localYnumberNoThe y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position.
dragState0 | 12No
dragStartXnumberNoThe x coordinate of the Game Object that owns this Interactive Object when the drag started.
dragStartYnumberNoThe y coordinate of the Game Object that owns this Interactive Object when the drag started.
dragStartXGlobalnumberNoThe x coordinate that the Pointer started dragging this Interactive Object from.
dragStartYGlobalnumberNoThe y coordinate that the Pointer started dragging this Interactive Object from.
dragXnumberNoThe x coordinate that this Interactive Object is currently being dragged to.
dragYnumberNoThe y coordinate that this Interactive Object is currently being dragged to.

Type: object

Member of: Phaser.Types.Input

Source: src/input/typedefs/InteractiveObject.js#L1
Since: 3.0.0