Interface SurfaceMagnetizeOptions

Options for the magnetize functionality of the Surface.

interface SurfaceMagnetizeOptions {
    afterDrag?: boolean;
    afterGroupCollapse?: boolean;
    afterGroupExpand?: boolean;
    afterGroupGrow?: boolean;
    afterGroupResize?: boolean;
    afterGroupShrink?: boolean;
    afterLayout?: boolean;
    constant?: boolean;
    constrainToViewport?: boolean;
    repositionDraggedElement?: boolean;
    trackback?: boolean;
    trackbackThreshold?: number;
}

Properties

afterDrag?: boolean

If true, magnetizer will be run after a vertex is dragged.

afterGroupCollapse?: boolean

Defaults to false. Indicates the surface should gather nodes around a newly collapsed group

afterGroupExpand?: boolean

Defaults to false. Indicates the surface should magnetize nodes around a newly expanded group

afterGroupGrow?: boolean

Defaults to false. Indicates the surface should magnetize/gather nodes around a newly resized group if the group size was enlarged.

afterGroupResize?: boolean

Defaults to false. Indicates the surface should magnetize/gather nodes around a newly resized group, regardless of whether the group size grew or if it shrunk. This flag is the same as setting afterGroupShrink and afterGroupGrow

afterGroupShrink?: boolean

Defaults to false. Indicates the surface should magnetize/gather nodes around a newly resized group if the group size was reduced.

afterLayout?: boolean

If true, magnetizer will be run after the layout is run.

constant?: boolean

If true, magnetizer will be run constantly as a vertex is being dragged, pushing other vertices out of the way of the vertex that is being dragged

constrainToViewport?: boolean

If true, vertices moved by the magnetizer will be constrained to move within the visible viewport, which is a function of the current zoom/pan of the surface. Otherwise, vertices will be able to be pushed out of the visible viewport.

repositionDraggedElement?: boolean

If true, and afterDrag is true, when the magnetizer is run after a drag it will be the recently dragged element that moves in precedence to the other elements. By default, the recently dragged element is not moved by the magnetize operation - it stays where you dragged it.

trackback?: boolean

Used in conjunction with constant: attempts to reposition any moved elements to their original positions, or as close as possible, each time the magnetizer runs a sweep. Defaults to false.

trackbackThreshold?: number

When in constant mode and trackback is set, this value specifies a threshold for elements that have been pushed from their original position. Beyond this threshold, the magnetizer will no longer attempt to track an element back. This can be useful in certain situations where the user does want to move an element by pushing it via the magnetizer

Version :