visjs-community / visjs-network

the network module from vis.js
Apache License 2.0
60 stars 21 forks source link

Network - does updating an edge cause it to reset automatically in Hierarchical view? #67

Closed DarylMcCullough closed 5 years ago

DarylMcCullough commented 5 years ago

This bug was reported for vis.js, but was never resolved, as far as I know. I believe that it is still a bug for visjs-network, as well.

https://github.com/datastorm-open/visNetwork/issues/162

The behavior is the following: For a very simple network with one hidden edge, if you change the shape of the network manually by dragging a node, then the network will reset to the original position. A working example is here:

javascript-example-from-visjs.zip

Open the html file test.html. You'll see a tiny network with three nodes. Drag the node in the lower left to a new position farther right. If you then hover over the node with your mouse, the network will reset to its original shape.

DarylMcCullough commented 5 years ago

I looked at the javascript code, and apparently the line that is causing the problem is this one (in lib/network/modules/components/Edge.js,)

if (options.hidden !== undefined || options.physics !== undefined) { dataChanged = true; }

I'm not sure why this line is there. It seems that it should only be if options.hidden has changed, not if it's been set.

micahstubbs commented 5 years ago

hi @DarylMcCullough, thanks for reporting this one!

I'd be happy to review a pull request if you would like to submit the fix, along with an example that shows the bug (and the fix).

DarylMcCullough commented 5 years ago

I created an example, which I put into the "test" folder. I created a pull request. --Daryl On Saturday, June 8, 2019, 11:46:25 PM EDT, Micah Stubbs notifications@github.com wrote:

hi @DarylMcCullough, thanks for reporting this one!

I'd be happy to review a pull request if you would like to submit the fix, along with an example that shows the bug (and the fix).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

micahstubbs commented 5 years ago

Thanks for sending the PR! I hope to review the PR and get it in sometime over the upcoming July 4th holiday.