Class GuidedDraggingTool

GoJS® Diagramming Components
version 3.0.1
by Northwoods Software®

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.

Hierarchy

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.

Index

Constructors

Accessors

  • 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".

Methods

  • Removes all of the guidelines from the grid.

    Returns void

  • Calls the base method and removes the guidelines from the graph.

    Returns void

  • On a mouse-up, snaps the selected part to the nearest guideline. If not snapping, the part remains at its position.

    Parameters

    Returns void

  • 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.

    Parameters

    Returns void

  • This predicate decides whether or not the given Part should guide the dragged part.

    Parameters

    • part: Part

      a stationary Part to which the dragged part might be aligned

    • guidedpart: Part

      the Part being dragged

    Returns boolean

  • This 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.

    Parameters

    • part: Part
    • guideline: boolean

      if true, show guideline

    • snap: boolean

      if true, snap the part to where the guideline would be

    Returns void

  • 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.

    Parameters

    • part: Part
    • guideline: boolean

      if true, show guideline

    • snap: boolean

      if true, don't show guidelines but just snap the part to where the guideline would be

    Returns void

Properties