Is it possible to implement Visio-like automatic link connection in JointJS? #2992
IntroductionIn Microsoft Visio, when a user drag the link near a element on the paper, the link automatically detects the nearby element and snaps to it, establishing a connection between the source and the target. I would like to reproduce this behavior in JointJS. Specifically, I want links to automatically connect to the closest element when drawn near it, just like in Visio. Is it possible to implement such functionality in JointJS? If so, what approach or APIs should I use? Any advice or examples would be appreciated. Steps to reproduceNo response Restrictions & ConstraintsThe solution must work with the JointJS+ library. Does your question relate to JointJS or JointJS+. Select both if applicable.JointJS+ |
Answered by
zbynekstara
Jun 16, 2025
Replies: 1 comment 1 reply
|
Hi Tetsu-hub, You can achieve this with the const paper = new dia.Paper({
// ...
snapLinks: { radius: 50 }
}); |
1 reply
Answer selected by
Tetsu-hub
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Tetsu-hub,
You can achieve this with the
snapLinksoption on Paper (https://docs.jointjs.com/api/dia/Paper/#snaplinks), like this: