This is an extension and not part of the main GoJS library. Note that the API for this class may change at any time. If you intend to use an extension in production, you should copy the code to your own source directory. See the Extensions intro page for more information.
Optional
init: Partial<DrawCommandHandler>Gets or sets the arrow key behavior. Possible values are "move", "select", "scroll", "tree", and "none".
The default value is "move".
Gets or sets the offset at which each repeated pasteSelection puts the new copied parts from the clipboard.
This controls whether or not the user can invoke the alignLeft, alignRight, alignTop, alignBottom, alignCenterX, alignCenterY commands.
This returns true: if the diagram is not go.Diagram.isReadOnly, if the model is not go.Model.isReadOnly, and if there are at least two selected go.Parts.
This controls whether or not the user can invoke the rotate command.
This returns true: if the diagram is not go.Diagram.isReadOnly, if the model is not go.Model.isReadOnly, and if there is at least one selected go.Part.
Override
copyOverride
doThis implements custom behaviors for arrow key keyboard events. Set arrowKeyBehavior to "select", "move" (the default), "scroll" (the standard behavior), or "none" to affect the behavior when the user types an arrow key.
Override
pasteChange the z-ordering of selected parts to pull them forward, in front of all other parts in their respective layers. All unselected parts in each layer with a selected Part with a non-numeric go.Part.zOrder will get a zOrder of zero.
Change the z-ordering of selected parts to push them backward, behind of all other parts in their respective layers. All unselected parts in each layer with a selected Part with a non-numeric go.Part.zOrder will get a zOrder of zero.
Change the angle of the parts connected with the given part. This is in the command handler so it can be easily accessed for the purpose of creating commands that change the rotation of a part.
the positive (clockwise) or negative (counter-clockwise) change in the rotation angle of each Part, in degrees.
Position each selected non-Link horizontally so that each distance between them is the same, given the total width of the area occupied by them. Their Y positions are not modified. It tries to maintain the same ordering of selected Parts by their X position.
Note that if there is not enough room, the spacing might be negative -- the Parts might overlap.
Position each selected non-Link vertically so that each distance between them is the same, given the total height of the area occupied by them. Their X positions are not modified. It tries to maintain the same ordering of selected Parts by their Y position.
Note that if there is not enough room, the spacing might be negative -- the Parts might overlap.
This CommandHandler class allows the user to position selected Parts in a diagram relative to the first part selected, in addition to overriding the doKeyDown method of the CommandHandler for handling the arrow keys in additional manners.
Typical usage:
or:
If you want to experiment with this extension, try the Drawing Commands sample.