Drag manager is responsible for handling the dragging of stage elements supports click-n-stick and click-n-drag functionality.
_handlePointSnap
localMousePos
dragOffset
obj
Handles snapping the dragged object to the nearest among a list of points
localMousePos
PIXI.Point
The mouse position in the same space as the dragged object.
dragOffset
PIXI.Point
The drag offset for the dragged object.
obj
PIXI.DisplayObject
The object to snap.
_objMouseDown
object
interactionData
Mouse down on an object
object
PIXI.DisplayObject
The object that should be dragged.
interactionData
PIXI.InteractionData
The interaction data about the input event that triggered this.
_startDrag
interactionData
Internal start dragging on the stage
interactionData
PIXI.InteractionData
The ineraction data about the moved mouse
_stopDrag
interactionData
doCallback
Internal stop dragging on the stage
interactionData
PIXI.InteractionData
The ineraction data about the moved mouse
doCallback
Bool
If we should do the callback
_triggerHeldDrag
interactionData
Start hold dragging
interactionData
PIXI.InteractionData
The ineraction data about the moved mouse
_triggerStickyClick
interactionData
Start the sticky click
interactionData
PIXI.InteractionData
The interaction data about the input event that triggered this.
_updateObjPosition
interactionData
Update the object position based on the mouse
interactionData
PIXI.InteractionData
Mouse move event
addObject
obj
[bounds]
[dragOffset]
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), _dragOffset (Point), _onMouseDownListener (Function), _dragMan (springroll.DragManager) reference to the DragManager these will override any existing properties of the same name
obj
PIXI.DisplayObject
The display object
[bounds]
PIXI.Rectangle
optional
The rectangle bounds. 'right' and 'bottom' properties will be added to this object.
[dragOffset]
PIXI.Point
optional
A specific drag offset to use each time, instead of the mousedown/touchstart position relative to the object. This is useful if you want something to always be dragged from a specific position, like the base of a torch.
removeObject
obj
Removes properties and functions added by addObject().
obj
PIXI.DisplayObject
The display object
startDrag
object
interactionData
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. When using multitouch, passing a interaction data is required.
object
PIXI.DisplayObject
The object that should be dragged.
interactionData
PIXI.InteractionData
The interaction data about the input event that triggered this.
stopDrag
[doCallback=false]
[obj]
Stops dragging the currently dragged object.
[doCallback=false]
Bool
optional
If the drag end callback should be called.
[obj]
PIXI.DisplayObject
optional
A specific object to stop dragging, if multitouch is true. If this is omitted, it stops all drags.
_addedDragListeners
If this DragManager has added drag listeners to the InteractionManager
_dragOffset
The offset from the dragged object's position that the initial mouse event was at. This is only used when multitouch is false - the DragData has it when multitouch is true.
draggedObj
The object that's being dragged, or a dictionary of DragData being dragged by id if multitouch is true.
dragStartThreshold
The radius in pixel to allow for dragging, or else does sticky click
Default: 20
isStickyClick
Is the drag a sticky clicking (click on a item, then mouse the mouse)
Default: false
mouseDownObjPos
The position x, y of the object when interaction with it started. If multitouch is true, then this will only be set during a drag stop callback, for the object that just stopped getting dragged.
mouseDownStagePos
The position x, y of the mouse down on the stage. This is only used when multitouch is false - the DragData has it when multitouch is true.
multitouch
If the DragManager allows multitouch dragging. Setting this stops any current drags.
snapSettings
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