Placement guides to see alignment

Hello,

I cam comparing multiple diagram solutions and I would like to know if gojs has the ability to show placement guides to see if nodes are well aligned with each other when moving them (other library like mxgraph have this ability)? Thank you for your answer.

Those are called “guidelines”. Use the GuidedDraggingTool extension.

Several samples use this, including:
https://gojs.net/latest/extensions/GuidedDragging.html.

Some documentation is at:
https://gojs.net/latest/api/symbols/GuidedDraggingTool.html.

Thank you for your answer.

I also try to make the links straight when they are not connected to any node. I anderstand that `

dragComputation: function (part, pt, gridpt) { return gridpt; }

makes the link snap to grid when moving the entire link. However, I would like the handle of the link also snap to grid when moving only the handle. That would help the user make straight links. I there such a possibility?

For snapping the intermediate points of a link to a grid, use the SnapLinkReshapingTool extension. See it used at https://gojs.net/latest/extensions/SnapLinkReshaping.html and defined at https://gojs.net/latest/extensions/SnapLinkReshapingTool.js.

I don’t think there is an example of snapping the end points of a link to a grid, but I think you could modify the LinkShiftingTool extension, demonstrated at https://gojs.net/latest/extensions/LinkShifting.html and defined at https://gojs.net/latest/extensions/LinkShiftingTool.js. But I’m not sure that tool works for completely disconnected Links.

A post was split to a new topic: How to keep tree roots at original locations