MagnetizeOptions
Options for the magnetize functionality of the UI.
Properties
afterDrag?
optionalafterDrag:boolean
If true, magnetizer will be run after a vertex is dragged. Defaults to false.
afterGroupCollapse?
optionalafterGroupCollapse:boolean
Defaults to false. Indicates the UI should gather nodes around a newly collapsed group
afterGroupExpand?
optionalafterGroupExpand:boolean
Defaults to false. Indicates the UI should magnetize nodes around a newly expanded group
afterGroupGrow?
optionalafterGroupGrow:boolean
Defaults to false. Indicates the UI should magnetize/gather nodes around a newly resized group if the group size was enlarged.
afterGroupResize?
optionalafterGroupResize: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?
optionalafterGroupShrink:boolean
Defaults to false. Indicates the UI should magnetize/gather nodes around a newly resized group if the group size was reduced.
afterLayout?
optionalafterLayout:boolean
If true, magnetizer will be run after the layout is run.
constant?
optionalconstant: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. Defaults to false. By default, constant magnetize will also set trackback:true, but you can disable that behaviour by setting trackback:false.
constrainToViewport?
optionalconstrainToViewport: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 UI. Otherwise, vertices will be able to be pushed out of the visible viewport.
padding?
optionalpadding:PointXY
How much padding to leave between elements. Defaults to 100 pixels in each axis.
repositionDraggedElement?
optionalrepositionDraggedElement: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?
optionaltrackback:boolean
Used in conjunction with constant: attempts to track any moved elements to their original positions (or as close as possible) once the path is clear, each time the magnetizer runs a sweep. Defaults to true (when constant is true).
trackbackThreshold?
optionaltrackbackThreshold: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