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;
}

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.