Snap to grid on links

Hi,

When reshaping and having multiple segments on the link - is it possible to make the links snap to grid?

This has been on our “to do” list for years, waiting for someone to ask for it. I’ll see if I can cook up an extension to LinkReshapingTool.

Try this:

[
EDIT: This 6-year old code has been replaced by the SnapLinkReshapingTool extension.

API: Snap Link Reshaping
sample: SnapLinkReshapingTool | GoJS API
TypeScript: https://gojs.net/latest/extensionsTS/SnapLinkReshapingTool.ts
JavaScript: https://gojs.net/latest/extensions/SnapLinkReshapingTool.js
]

Works perfectly fine! Thank you for your quick support!

Hey @walter ,
I was using SnapLinkReshapingTool as LinkReshapingTool, it is working fine but in some instances, when I try to move a corner link, it breaks the whole page and the page becomes unresponsive.

There are no particular steps to reproduce it, it happens while playing around with the links.
Can you think of the reason for this behaviour?

Thanks in advance.

Ha. That ancient code has been superseded by an extension of the same name, but with additional features. I have updated that old post of mine, above.

First, try using go-debug.js instead of go.js and see if there are any warnings or errors in the console.

Second, use the new SnapLinkReshapingTool extension instead of that old code.

https://github.com/NorthwoodsSoftware/GoJS/blob/master/extensions/SnapLinkReshapingTool.js
I have used this SnapLinkReshapingTool code, is it not the latest one?

That is indeed the latest one. So, how can we reproduce the bug? Could you please share two small screenshots showing before the “hang” and after? Please also describe exactly what the gesture was that caused the problem.

Here’s the screenshot, when I try to move the edge shown with an arrow, it breaks the page.
There are no specific steps to reproduce, it just happens randomly while playing around with the Links, but when a link comes in broken state, trying to move that always breaks the page.

Just before dragging:

After dragging, this is the frozen state:

Odd. Can you reproduce the problem at all in Snap Link Reshaping ?

Can you reproduce the problem in your app in other browsers or on other platforms?

Also, it would be nice if you could share your link template – maybe I can try to reproduce the problem on my own.