I was wondering if gojs is able to “toggle” a link connection rather than having to “click” the port “hold and drag” to other port. To clarify “toggle”, a user would click the port, the linking tool will activate, and when you click another port or the diagram it self it will either link to a port or cancel the linking tool.
I recently discovered that using the “TwoClickLinking” example, with my current diagram, if I click an port that is already connected to another port, it will freeze the diagram. After some debugging, I have found that e.diagram.currentTool = tool in the following code causes it to freeze.
Do you have any insight on what might be causing this or how to further debug?
port.part.isSelected = false
e.handled = true // don't bubble up
const tool = e.diagram.toolManager.linkingTool
console.log('port', port)
tool.startObject = port
// assigning found tool to the current tool is causing freeze
e.diagram.currentTool = tool
tool.doActivate()
That’s very odd. I am unable to reproduce any problem when trying to link ports in that TwoClickLinking sample. I tried all four combinations of connecting both from and to both open and already-connected ports. I also tried clicking both on output and on input ports (drawing the new link “backwards”).
If you break into the running code, what can you discover?