Class: UIButtonDraggable

PhaserComps.UIComponents. UIButtonDraggable

Same as UIComponents.UIButton, but also emits EVENT_DRAG with two arguments, horizontal and vertical movement delta


new UIButtonDraggable( [parent] [, key] [, labelText])

Parameters:
Name Type Argument Description
parent PhaserComps.UIComponents.UIComponentPrototype <optional>

UIComponentPrototype instance to find clip inside

key String <optional>

key to find clip inside parent

labelText String <optional>

text to set for a 'label' key

Properties:
Name Type Description
enable Boolean

activate/deactivate button interaction. if false, button state is set to disable

label String

get/set button label text

Fires:
  • event:EVENT_CLICK,
  • event:EVENT_DRAG,

Extends

  • UIComponents.UIButton

Methods


<protected> _onDrag(pointer, gameObject, dragX, dragY)

_dragZone drag event callback

Parameters:
Name Type Description
pointer
gameObject Phaser.GameObjects.GameObject
dragX Number
dragY Number

<protected> _onDragStart(pointer, gameObject)

_dragZone dragstart event callback

Parameters:
Name Type Description
pointer
gameObject Phaser.GameObjects.GameObject

setDragBounds(minX, minY, maxX, maxY)

Set clip drag bounds

Parameters:
Name Type Description
minX Number

left drag bound

minY Number

top drag bound

maxX Number

right drag bound

maxY Number

bottom drag bound

Type Definitions


DragBounds

Properties:
Name Type Description
minX Number

left drag bound

minY Number

top drag bound

maxX Number

right drag bound

maxY Number

bottom drag bound

Events


EVENT_DRAG

Emitted on drag move.

Parameters:
Name Type Description
x Number

horizontal drag movement (from drag start)

y Number

vertical drag movement (from drag start)