Hi, I tried to borrow this example into our code base to use adornment to support dragging to create a new link.
When I hovered over a node, a circle appears on the right-hand side as adornment so I could a drag a new link from the node. If I hovered over a different node in the same screen, the link drawn from the corresponding node, as expected. The two animated gifs below show the correct behavior.
However, the weird thing happened when I did the following:
I dragged a link from node A.
I scrolled the diagram horizontally so that node A was off the screen.
I hovered over node B in the current screen and tried to drag a link from its adornment, the temporary link was from node A that is off the screen.
The same weird effect happened even when I scrolled the diagram to make node A visible again.
But when I dropped the temporary link to another node, the newly created link started from node B, which is correct, even though the temporary link always started from node A, as shown below.
The critical step to trigger this weird behavior is to make the first node that we dragged a link from off the screen.
I debugged a little bit. The tool.startObject in the drawLink method is the correct port in node B. But the temporary link started from node A :(
I tried to reproduce it in a simpler GoJS code but have not succeeded yet. Do you have any clue why the behavior happens and how to fix it?
The LinkingTool reuses a single Link, the LinkingBaseTool.temporaryLink. On the second and subsequent uses of that tool, I suspect it is briefly showing where the temporary link had been in its last use. But I had thought we had fixed that problem years ago.
That’s odd – I copied your code, noticed that behavior, added that one location-setting statement, and that behavior disappeared. So I do not understand why it would be different for you.
Hi Walter, maybe we are talking about two different issues. I no longer see the jump of the temporary link, which is good.
But I still see the original issue in jsfiddle: when you dragged a link from node A, scrolled away node A, and tried to drag a link from node B, the temporary link still started from node A.
Hi Walter, I took another screen recording of the jsfiddle code. As you can see below, the first dragging worked fine. But when I scrolled the diagram to the right and did the second dragging, the temporary link started from somewhere outside the diagram on the left.
If possible, can you please take a screen recording of the working behavior from jsfiddle and share it with me? Thanks!