API Documentation for: 0.0.1
Show:

DragManager Class

Defined in: DragManager:8
Namespace: cloudkid

Drag manager is responsible for handling the dragging of stage elements supports click-n-stick and click-n-drag functionality.

Constructor

DragManager

(
  • stage
  • startCallback
  • endCallback
)

Defined in DragManager:8

Parameters:

  • stage PIXI.Stage

    The stage that this DragManager is monitoring.

  • startCallback Function

    The callback when when starting

  • endCallback Function

    The callback when ending

Methods

_handlePointSnap

(
  • localMousePos
)
private

Handles snapping the dragged object to the nearest among a list of points

Parameters:

  • localMousePos createjs.Point

    The mouse position in the same space as the dragged object.

_objMouseDown

(
  • type
  • object
)
private

Defined in _objMouseDown:213

Mouse down on an obmect

Parameters:

  • type Int

    The type of input that triggered this call - either TYPE_MOUSE or TYPE_TOUCH.

  • object PIXI.DisplayObject

    The object that should be dragged.

_startDrag

() private

Defined in _startDrag:287

Internal start dragging on the stage

_stopDrag

(
  • ev
  • doCallback
)
private

Defined in _stopDrag:312

Internal stop dragging on the stage

Parameters:

  • ev Event

    Mouse up event

  • doCallback Bool

    If we should do the callback

_triggerHeldDrag

(
  • interactionData
)
private

Start hold dragging

Parameters:

  • interactionData PIXI.InteractionData

    The ineraction data about the moved mouse

_triggerStickyClick

() private

Start the sticky click

_updateObjPosition

(
  • interactionData
)
private

Update the object position based on the mouse

Parameters:

  • interactionData PIXI.InteractionData

    Mouse move event

addObject

(
  • obj
  • bound
)
public

Defined in addObject:440

Adds properties and functions to the object - use enableDrag() and disableDrag() on objects to enable/disable them (they start out disabled). Properties added to objects: _dragBounds (Rectangle), _onMouseDownListener (Function), _dragMan (cloudkid.DragManager) reference to the DragManager these will override any existing properties of the same name

Parameters:

  • obj PIXI.DisplayObject

    The display object

  • bound PIXI.Rectangle

    The rectangle bounds

destroy

() public

Defined in destroy:496

Destroy the manager

initialize

(
  • stage
  • startCallback
  • endCallback
)

Defined in initialize:178

Constructor

Parameters:

  • stage PIXI.Stage

    The stage that this DragManager is monitoring.

  • startCallback Function

    The callback when when starting

  • endCallback Function

    The callback when ending

removeObject

(
  • obj
)
public

Defined in removeObject:474

Removes properties and functions added by addObject().

Parameters:

  • obj PIXI.DisplayObject

    The display object

startDrag

(
  • object
  • interactionData
)
public

Defined in startDrag:200

Manually starts dragging an object. If a mouse down event is not supplied as the second argument, it defaults to a held drag, that ends as soon as the mouse is released.

Parameters:

  • object PIXI.DisplayObject

    The object that should be dragged.

  • interactionData PIXI.InteractionData

    The interaction data about the input event that triggered this.

stopDrag

(
  • doCallback
)
public

Defined in stopDrag:301

Stops dragging the currently dragged object.

Parameters:

  • doCallback Bool

    If the drag end callback should be called. Default is false.

Properties

_dragEndCallback

Function private

External callback when we are done dragging

_draggableObjects

Array private

The collection of draggable objects

_dragOffset

PIXI.Point private

Defined in _dragOffset:117

The local to global position of the drag

_dragStartCallback

Function private

External callback when we start dragging

_stageMouseUpCallback

Function private

Callback when we are done with the drag

_theStage

PIXI.Stage private

Defined in _theStage:110

Reference to the stage

_triggerHeldDragCallback

Function private

Callback to test for the start a held drag

_triggerStickyClickCallback

Function private

Callback to start a sticky click drag

_updateCallback

Function private

Defined in _updateCallback:159

The function call when the mouse/touch moves

allowStickyClick

Bool public

Defined in allowStickyClick:83

If sticky click dragging is allowed.

Default: true

draggedObj

PIXI.DisplayObject public

Defined in draggedObj:26

The object that's being dragged

dragStartThreshold

Unknown public

The radius in pixel to allow for dragging, or else does sticky click

Default: 20

isHeldDrag

Bool public

Defined in isHeldDrag:65

Is the drag being held on mouse down (not sticky clicking)

Default: false

isStickyClick

Bool public

Defined in isStickyClick:74

Is the drag a sticky clicking (click on a item, then mouse the mouse)

Default: false

isTouchMove

Bool public

Defined in isTouchMove:56

Is the move touch based

Default: false

mouseDownObjPos

PIXI.Point private

Defined in mouseDownObjPos:49

The position x, y of the object when interaction with it started.

mouseDownStagePos

PIXI.Point private

The position x, y of the mouse down on the stage

snapSettings

Object public

Defined in snapSettings:91

Settings for snapping.

Format for snapping to a list of points: { mode:"points", dist:20,//snap when within 20 pixels/units points:[ { x: 20, y:30 }, { x: 50, y:10 } ] }

Default: null