Appearance
Ogma.tools.snapping
Snapping API: functions to snap nodes to guidelines while dragging them.
ogma.tools.snapping.disable()
Disables snapping mode in nodes dragging.
ogma.tools.snapping.enable([options])
Enables the snapping mode while dragging the nodes.
Arguments
- options(optional)
object
centerSnapDistance(optional)
Number
[=240]
Maximum distance between 2 nodes that allowes their centers to be alignedenabled(optional)
Boolean
[=false]
Indicates whether the snapping is on when the node is being draggedguidelineColor(optional)
Color
[='red']
Color of the axis-ligned guidelinesguidelineWidth(optional)
Number
[=1]
Width of the alignment guidelineneighbours(optional)
object
Equal nodes distribution: snaps a node to the middle of the distance between two other nodes or to the same distance as two of its neighbours- enabled(optional)
Boolean
[=true]
Enables the mode. - lineColor(optional)
Color
[=#00C3FF]
Guideline color - lineWidth(optional)
Number
[=1]
Guideline width - offset(optional)
Number
[=5]
Distance between the guideline and common bounding box of aligned nodes - tolerance(optional)
Number
[=3]
Snapping distance
- enabled(optional)
preferredDistance(optional)
object
Options for preferred ditance snapping: pairwise snapping of the nodes based on their distance- enabled(optional)
Boolean
[=true]
Enables the mode. - lineColor(optional)
Color
[=#00C3FF]
Guideline color - lineWidth(optional)
Number
[=1]
Guideline width - ratio(optional)
Number
[=1.13]
Preferred distance ratio between nodesa
andb
, according to the formulad = (Ra + Rb) * ratio
- tolerance(optional)
Number
[=10]
Snapping distance
- enabled(optional)
sideSnapDistanceFactor(optional)
Number
[=3]
Maximum distance between 2 nodes that allowes their sides to be aligned. The value is the factor of dragged node diameter.tolerance(optional)
Number
[=5]
Pixel tolerance distance within which node is snapped towards the guideline