BlockDragger class
Class for a block dragger. It moves blocks around the workspace when they are being dragged by a mouse or touch.
Signature:
export declare class BlockDragger implements IBlockDragger
Implements: IBlockDragger
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)(block, workspace) | Constructs a new instance of the BlockDragger class |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
draggedConnectionManager_ | protected |
InsertionMarkerManager | |
draggingBlock_ | protected |
BlockSvg | The top block in the stack that is being dragged. |
dragIconData_ | protected |
IconPositionData[] | |
startXY_ | protected |
Coordinate | |
workspace_ | protected |
WorkspaceSvg | The workspace on which the block is being dragged. |
wouldDeleteBlock_ | protected |
boolean | Whether the block would be deleted if dropped immediately. |
Methods
Method | Modifiers | Description |
---|---|---|
disconnectBlock_(healStack, currentDragDeltaXY) | protected |
Disconnects the block and moves it to a new location. |
drag(e, currentDragDeltaXY) | Execute a step of block dragging, based on the given event. Update the display accordingly. | |
dragIcons_(dxy) | protected |
Move all of the icons connected to this drag. |
endDrag(e, currentDragDeltaXY) | Finish a block drag and put the block back on the workspace. | |
fireDragEndEvent_() | protected |
Fire a UI event at the end of a block drag. |
fireDragStartEvent_() | protected |
Fire a UI event at the start of a block drag. |
fireMoveEvent_() | protected |
Fire a move event at the end of a block drag. |
getInsertionMarkers() | Get a list of the insertion markers that currently exist. Drags have 0, 1, or 2 insertion markers. | |
getNewLocationAfterDrag_(currentDragDeltaXY) | protected |
Calculates the drag delta and new location values after a block is dragged. |
maybeDeleteBlock_() | protected |
May delete the dragging block, if allowed. If this.wouldDeleteBlock_ is not true, the block will not be deleted. This should be called at the end of a block drag. |
pixelsToWorkspaceUnits_(pixelCoord) | protected |
Convert a coordinate object from pixels to workspace units, including a correction for mutator workspaces. This function does not consider differing origins. It simply scales the input's x and y values. |
shouldDisconnect_(healStack) | protected |
Whether or not we should disconnect the block when a drag is started. |
startDrag(currentDragDeltaXY, healStack) | Start dragging a block. This includes moving it to the drag surface. | |
updateBlockAfterMove_() | protected |
Updates the necessary information to place a block at a certain location. |
updateCursorDuringBlockDrag_() | protected |
Update the cursor (and possibly the trash can lid) to reflect whether the dragging block would be deleted if released immediately. |
updateToolboxStyle_(isEnd) | protected |
Adds or removes the style of the cursor for the toolbox. This is what changes the cursor to display an x when a deletable block is held over the toolbox. |