Draggable Component

Enable drag and drop of the entity. Listens to events from MouseDrag and moves entity accordingly.

See Also

Methods

Back to top

.disableDrag()

public this .disableDrag(void)

Disables entity dragging. Reenable with .enableDrag().

See Also

Back to top

.dragDirection()

Method used for modifying the drag direction. If direction is set, the entity being dragged will only move along the specified direction. If direction is not set, the entity being dragged will move along any direction.

public this .dragDirection()

Remove any previously specified direction.

public this .dragDirection(vector)
vector

Of the form of {x: valx, y: valy}, the vector (valx, valy) denotes the move direction.

public this .dragDirection(degree)
degree

A number, the degree (clockwise) of the move direction with respect to the x axis.

Specify the dragging direction.

Example

this.dragDirection()
this.dragDirection({x:1, y:0}) //Horizontal
this.dragDirection({x:0, y:1}) //Vertical
// Note: because of the orientation of x and y axis,
// this is 45 degree clockwise with respect to the x axis.
this.dragDirection({x:1, y:1}) //45 degree.
this.dragDirection(60) //60 degree.
Back to top

.enableDrag()

public this .enableDrag(void)

Reenable dragging of entity. Use if .disableDrag has been called.

See Also