Is it possible to explicitly switch between dragging and linking modes in GoJS? I am trying to achieve a behavior similar to other diagram editors out there:
I believe I've seen such example but now cannot find it after couple hours of searching. An attempt to set diagram.toolManager.xxxTool.enabled to "false" in JavaScript does not seem to have any effect on tool activation behavior.
I suspect your problem is just a typo, the property is isEnabled
, not enabled
.
For completeness: First you must set fromLinkable: true, toLinkable:true
(or at least one) on your Node or port to enable the linking tool. Then you can conditionally disable the tool via your button:
myDiagram.toolManager.linkingTool.isEnabled = false; // false to drag, true to link
You can actually write that line in the console and see it live on a sample like Basic