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.
Extensions can be found in the GoJS kit under the
See the Extensions intro page for more information.
The DragZoomingTool lets the user zoom into a diagram by stretching a box to indicate the new contents of the diagram's viewport (the area of the model shown by the Diagram). Hold down the Shift key in order to zoom out.
The default drag selection box is a magenta rectangle. You can modify the box to customize its appearance.
You can use this tool in a modal manner by executing:
diagram.currentTool = new DragZoomingTool();
Use this tool in a mode-less manner by executing:
myDiagram.toolManager.mouseMoveTools.insertAt(2, new DragZoomingTool());
However when used mode-lessly as a mouse-move tool, in ToolManager.mouseMoveTools, this cannot start running unless there has been a motionless delay after the mouse-down event of at least delay milliseconds.
If you want to experiment with this extension, try the Drag Zooming sample.
Modifying this property while this tool Tool.isActive might have no effect.
Gets or sets the time in milliseconds for which the mouse must be stationary before this tool can be started.
The default value is 175 milliseconds. Setting this property does not raise any events.
This tool can run when there has been a mouse-drag, far enough away not to be a click, and there has been delay of at least delay milliseconds after the mouse-down before a mouse-move.
Capture the mouse and show the box.
Release the mouse and remove any box.