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

Blockly.BlockSvg

The block to drag.

Value must not be null.

workspace

Blockly.WorkspaceSvg

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

goog.math.Coordinate

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

goog.math.Coordinate

How far the pointer has moved from the position at the start of the drag, in pixel units.

Value must not be null.

startBlockDrag

startBlockDrag(currentDragDeltaXY, healStack)

Start dragging a block. This includes moving it to the drag surface.

Parameter

currentDragDeltaXY

goog.math.Coordinate

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