CommandHandler class
The Diagram#commandHandler implements various commands such as CommandHandler#deleteSelection or CommandHandler#redo. The CommandHandler includes keyboard event handling to interpret key presses as commands.
CommandHandlers cannot be shared amongst multiple Diagrams.
You may define a CommandHandler subclass and override methods. However you must seriously consider calling the base method in order to get its default behavior. There may be situations where not calling the base method may cause subtle bugs, but that depends on the method. Please read the Introduction page on Extensions for how to override methods and how to call a base method.
There is an example custom CommandHandler in the extensions directory: DrawCommandHandler.js, which provides alignment commands and additional behaviors for the arrow keys.
For additional discussion, please read the Introduction page on Commands.
Keyboard Shortcuts
The CommandHandler implements the following command bindings for keyboard input in #doKeyDown:
Ctrl-X
&Shift-Del
invoke #cutSelectionCtrl-C
&Ctrl-Insert
invoke #copySelectionCtrl-V
&Shift-Insert
invoke #pasteSelectionDel
&Backspace
invoke #deleteSelectionCtrl-A
invokes #selectAllCtrl-Z
&Alt-Backspace
invoke #undoCtrl-Y
&Alt-Shift-Backspace
invoke #redoUp
&Down
&Left
&Right
(arrow keys) call Diagram#scrollPageUp
&PageDown
call Diagram#scrollHome
&End
call Diagram#scrollSpace
invokes #scrollToPartCtrl-- & Keypad--
(minus) invoke #decreaseZoomCtrl-+ & Keypad-+
(plus) invoke #increaseZoomCtrl-0
invokes #resetZoomShift-Z
invokes #zoomToFit; repeat to return to the original scale and positionCtrl-G
invokes #groupSelectionCtrl-Shift-G
invokes #ungroupSelectionF2
invokes #editTextBlockMenu Key
invokes #showContextMenuEsc
invokes #stopCommand
On a Macintosh the Command key is used as the modifier instead of the Control key.
On touch devices there is a default context menu that shows many commonly-used commands when you hold a finger down on the diagram.
- Available extensions
- Annotations
-
- @JS()
- @staticInterop
Constructors
- CommandHandler()
-
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited