Blockly. BlockDragger
Constructor
BlockDragger
new BlockDragger(block, workspace)
Class for a block dragger. It moves blocks around the workspace when they are being dragged by a mouse or touch.
Parameter |
|
---|---|
block |
The block to drag. Value must not be null. |
workspace |
The workspace to drag on. Value must not be null. |
Methods
dispose
dispose()
Sever all links from this object.
dragBlock
dragBlock(e, currentDragDeltaXY)
Execute a step of block dragging, based on the given event. Update the display accordingly.
Parameter |
|
---|---|
e |
Event The most recent move event. Value must not be null. |
currentDragDeltaXY |
How far the pointer has moved from the position at the start of the drag, in pixel units. Value must not be null. |
endBlockDrag
endBlockDrag(e, currentDragDeltaXY)
Finish a block drag and put the block back on the workspace.
Parameter |
|
---|---|
e |
Event The mouseup/touchend event. Value must not be null. |
currentDragDeltaXY |
How far the pointer has moved from the position at the start of the drag, in pixel units. Value must not be null. |
getInsertionMarkers
getInsertionMarkers() returns Array of non-null Blockly.BlockSvg
Get a list of the insertion markers that currently exist. Drags have 0, 1, or 2 insertion markers.
- Returns
-
non-null Array of non-null Blockly.BlockSvg
A possibly empty list of insertion marker blocks.
startBlockDrag
startBlockDrag(currentDragDeltaXY, healStack)
Start dragging a block. This includes moving it to the drag surface.
Parameter |
|
---|---|
currentDragDeltaXY |
How far the pointer has moved from the position at mouse down, in pixel units. Value must not be null. |
healStack |
boolean Whether or not to heal the stack after disconnecting. |