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
| Property | Description |
|---|---|
| mover | - |
Methods index
| Method | Description |
|---|---|
| canMove | Returns true iff the given draggable is allowed to be moved. |
| isMoving | Returns true iff this Mover is currently moving an element. |
| startMove | Start moving the currently-focused item on workspace, if possible. |
| move | Moves the current element in the given direction. |
| finishMove | Finish moving the item that is currently being moved. |
| abortMove | Abort moving the currently-focused item on workspace. |
| setMoveDistance | Sets the distance by which an object will be moved. |
| getAllowedShortcuts | Returns a list of the names of shortcuts that are allowed to be run while a keyboard-driven move is in progress. |
| setAllowedShortcuts | 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. |
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
| Parameter | Type | Description |
|---|---|---|
draggable | IDraggable | The 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
| Parameter | Type | Description |
|---|---|---|
draggable | IDraggable | The element to start moving. |
event? | KeyboardEvent | The 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
| Parameter | Type | Description |
|---|---|---|
direction | Direction | The direction to move the currently-moving element. |
event? | PointerEvent | KeyboardEvent | The 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
| Parameter | Type | Description |
|---|---|---|
event? | PointerEvent | KeyboardEvent | The 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
| Parameter | Type | Description |
|---|---|---|
event? | PointerEvent | KeyboardEvent | The 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
| Parameter | Type | Description |
|---|---|---|
stepDistance | number | The 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
| Parameter | Type |
|---|---|
shortcutNames | string[] |
Returns
void