Skip to main content

Interface: IDragStrategy

Defined in: packages/blockly/core/interfaces/i_draggable.ts:30

Extended by

Methods index

MethodDescription
isMovableReturns true iff the element is currently movable.
startDragHandles any drag startup (e.g moving elements to the front of the workspace).
dragHandles moving elements to the new location, and updating any visuals based on that (e.g connection previews for blocks).
endDragHandles any drag cleanup, including e.g. connecting or deleting blocks.
revertDragMoves the draggable back to where it was at the start of the drag.

Methods

isMovable()

isMovable(): boolean;

Defined in: packages/blockly/core/interfaces/i_draggable.ts:32

Returns true iff the element is currently movable.

Returns

boolean


startDrag()

startDrag(e?): IDraggable;

Defined in: packages/blockly/core/interfaces/i_draggable.ts:42

Handles any drag startup (e.g moving elements to the front of the workspace).

Parameters

ParameterTypeDescription
e?PointerEvent | KeyboardEventEvent that started the drag; can be used to check modifier keys, etc. May be missing when dragging is triggered programmatically rather than by user.

Returns

IDraggable


drag()

drag(newLoc, e?): void;

Defined in: packages/blockly/core/interfaces/i_draggable.ts:53

Handles moving elements to the new location, and updating any visuals based on that (e.g connection previews for blocks).

Parameters

ParameterTypeDescription
newLocCoordinateWorkspace coordinate to which the draggable has been dragged.
e?PointerEvent | KeyboardEventEvent that continued the drag. Can be used to check modifier keys, etc.

Returns

void


endDrag()

endDrag(e, disposition): void;

Defined in: packages/blockly/core/interfaces/i_draggable.ts:63

Handles any drag cleanup, including e.g. connecting or deleting blocks.

Parameters

ParameterTypeDescription
ePointerEvent | KeyboardEvent | undefinedEvent that finished the drag. Can be used to check modifier keys, etc.
dispositionDragDispositionThe end result of the drag.

Returns

void


revertDrag()

revertDrag(): void;

Defined in: packages/blockly/core/interfaces/i_draggable.ts:69

Moves the draggable back to where it was at the start of the drag.

Returns

void