Function used to start dragging an element. Called when a hold event occurs (for elements dragged on push-and-hold) or on mousedown or dragStart. Returns an active "dragger" object when the user's finger is down and before the dragStart event actually occurs.
The dragger sets the scene up for dragging, preventing the drag from causing the scene to be scrolled. Both dragEnd and tap events cause the drag operation to end, since dragStart and dragEnd events cannot occur if there are no mousemove events. This sort of "aborted" drag operations are treated like any other, and will still cause the appropriate enter & drop methods to be called on the container.
Parameters | Type | Description |
---|---|---|
sceneController | String | Controller for the scene containing the element to be dragged |
element | String | DOM element ID to begin dragging |
startEvent | Event | User event that began the drag. |
options | Object | Additional drag options. See below. |
options object properties:
Property | Type | Description |
---|---|---|
draggingClass | String | CSS class to apply to the dragged element during dragging. Removed when dragging ends. |
preventVertical | Boolean | True prevents dragging in the vertical direction. Default is False. |
preventHorizontal | Boolean | True prevents dragging in the horizontal direction. Default is False. |
allowExit | Boolean | True allows the element to be dragged into containers other than its own. Default is False. |
preventDropReset | Boolean | True prevents the object from returning to its original position when dropped. To return the object to its original position with this option enabled, call resetElement() on dragger. |
datatype | String | The dragged element can only be dropped on containers specifying the same datatype. |
autoscroll | Boolean | True to automatically scroll the scene when the dragged element(s) reach the edge of the visible area. |
maxHorizontalPixel | Integer | Maximum horizontal position the object can be dragged to (in pixels) |
minHorizontalPixel | Integer | Minimum horizontal position in pixels the object can be dragged to (in pixels) |
maxVerticalPixel | Integer | Maximum vertical position the object can be dragged to (in pixels) |
minVerticalPixel | Integer | Minimum vertical position the object can be dragged to (in pixels) |
0 Comments