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.
Constructs a GuidedDraggingTool and sets up the temporary guideline parts.
Optional
init: Partial<GuidedDraggingTool>Gets or sets the color of center guidelines.
The default value is "gray".
Gets or sets the margin of error for which guidelines show up.
The default value is 6. Guidelines will show up when the aligned nodes are ± 6px away from perfect alignment.
Gets or sets the strokeWidth of the guidelines.
The default value is 1.
Gets or sets the color of horizontal guidelines.
The default value is "gray".
Gets or sets whether the guidelines are enabled or disables.
The default value is true.
Gets or sets whether snapping to guidelines is enabled.
The default value is true.
Gets or sets the distance around the selected part to search for aligned parts.
The default value is 1000. Set this to Infinity if you want to search the entire diagram no matter how far away.
Gets or sets the color of vertical guidelines.
The default value is "gray".
Override
doOverride
doShows vertical and horizontal guidelines for the dragged part.
Override
doOn a mouse-up, snaps the selected part to the nearest guideline. If not snapping, the part remains at its position.
When nodes are shifted due to being guided upon a drop, make sure all connected link routes are invalidated, since the node is likely to have moved a different amount than all its connected links in the regular operation of the DraggingTool.
Protected
isThis finds parts that are aligned near the selected part along horizontal lines. It compares the selected part to all parts within a rectangle approximately twice the searchDistance wide. The guidelines appear when a part is aligned within a margin-of-error equal to guidelineSnapDistance.
if true, show guideline
if true, snap the part to where the guideline would be
This finds parts that are aligned near the selected part along vertical lines. It compares the selected part to all parts within a rectangle approximately twice the searchDistance tall. The guidelines appear when a part is aligned within a margin-of-error equal to guidelineSnapDistance.
if true, show guideline
if true, don't show guidelines but just snap the part to where the guideline would be
The GuidedDraggingTool class makes guidelines visible as the parts are dragged around a diagram when the selected part is nearly aligned with another part.
If you want to experiment with this extension, try the Guided Dragging sample.