Skip to main content

Class: KeyboardMover

Defined in: packages/blockly/core/keyboard_nav/keyboard_mover.ts:36

Class responsible for coordinating keyboard-driven moves with the workspace and dragging system.

Properties index​

PropertyDescription
mover-

Methods index​

MethodDescription
canMoveReturns true iff the given draggable is allowed to be moved.
isMovingReturns true iff this Mover is currently moving an element.
startMoveStart moving the currently-focused item on workspace, if possible.
moveMoves the current element in the given direction.
finishMoveFinish moving the item that is currently being moved.
abortMoveAbort moving the currently-focused item on workspace.
setMoveDistanceSets the distance by which an object will be moved.
getAllowedShortcutsReturns a list of the names of shortcuts that are allowed to be run while a keyboard-driven move is in progress.
setAllowedShortcutsAdds shortcuts with the given names to the list of shortcuts that are allowed to be run while a keyboard-driven move is in progress.

Properties​

mover​

static mover: KeyboardMover;

Defined in: packages/blockly/core/keyboard_nav/keyboard_mover.ts:76

Methods​

canMove()​

canMove(draggable): boolean;

Defined in: packages/blockly/core/keyboard_nav/keyboard_mover.ts:90

Returns true iff the given draggable is allowed to be moved.

Parameters​

ParameterTypeDescription
draggableIDraggableThe draggable element to try to move.

Returns​

boolean

True iff movement is allowed.


isMoving()​

isMoving(): boolean;

Defined in: packages/blockly/core/keyboard_nav/keyboard_mover.ts:99

Returns true iff this Mover is currently moving an element.

Returns​

boolean

True iff a workspace element is being moved.


startMove()​

startMove(draggable, event?): boolean;

Defined in: packages/blockly/core/keyboard_nav/keyboard_mover.ts:110

Start moving the currently-focused item on workspace, if possible.

Parameters​

ParameterTypeDescription
draggableIDraggableThe element to start moving.
event?KeyboardEventThe keyboard event that triggered this move.

Returns​

boolean

True iff a move has successfully begun.


move()​

move(direction, event?): boolean;

Defined in: packages/blockly/core/keyboard_nav/keyboard_mover.ts:187

Moves the current element in the given direction.

Parameters​

ParameterTypeDescription
directionDirectionThe direction to move the currently-moving element.
event?PointerEvent | KeyboardEventThe event that triggered this move, if any.

Returns​

boolean

True iff this action applies and has been performed.


finishMove()​

finishMove(event?): boolean;

Defined in: packages/blockly/core/keyboard_nav/keyboard_mover.ts:218

Finish moving the item that is currently being moved.

Parameters​

ParameterTypeDescription
event?PointerEvent | KeyboardEventThe event that triggered the end of the move, if any.

Returns​

boolean

True iff move successfully finished.


abortMove()​

abortMove(event?): boolean;

Defined in: packages/blockly/core/keyboard_nav/keyboard_mover.ts:233

Abort moving the currently-focused item on workspace.

Parameters​

ParameterTypeDescription
event?PointerEvent | KeyboardEventThe event that triggered the end of the move, if any.

Returns​

boolean

True iff move successfully aborted.


setMoveDistance()​

setMoveDistance(stepDistance): void;

Defined in: packages/blockly/core/keyboard_nav/keyboard_mover.ts:248

Sets the distance by which an object will be moved.

Parameters​

ParameterTypeDescription
stepDistancenumberThe distance in workspace coordinates that each move should move elements on the workspace by.

Returns​

void


getAllowedShortcuts()​

getAllowedShortcuts(): string[];

Defined in: packages/blockly/core/keyboard_nav/keyboard_mover.ts:256

Returns a list of the names of shortcuts that are allowed to be run while a keyboard-driven move is in progress.

Returns​

string[]


setAllowedShortcuts()​

setAllowedShortcuts(shortcutNames): void;

Defined in: packages/blockly/core/keyboard_nav/keyboard_mover.ts:264

Adds shortcuts with the given names to the list of shortcuts that are allowed to be run while a keyboard-driven move is in progress.

Parameters​

ParameterType
shortcutNamesstring[]

Returns​

void