dash14 / v-network-graph

An interactive network graph visualization component for Vue 3

Home Page:https://dash14.github.io/v-network-graph/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dynamic node list, d3force and stored positions

kogratte opened this issue · comments

Hey :)

First of all, I'm aware of https://dash14.github.io/v-network-graph/examples/layout.html#fix-the-position-of-a-specific-node-in-the-force-layout.

BUT :)

https://www.loom.com/share/507ffbd7c00248e49807eeaf7ab69391

As you can see, the first time, positioning is indeed what was already stored.
If I hide / show nodes again, position is wrong.
If I reload the page, and show ancestors nodes, then they're well placed.

I cannot understand why they are well placed at round 1, but not after.

Hi @kogratte,
Sorry for the late reply, and thanks for reporting the Issue!

First, the library's behavior is that when a node is deleted from the graph, the position of the deleted node is also deleted from the layouts.
If layouts is specified as a bi-directional binding, the result of deletion is applied to the parent component's layouts. When re-adding a deleted node to the graph, the position before the deletion should be added to the layouts as well.

If layouts is specified as a unidirectional binding (not bidirectional), the deletion of a node position will not be applied to the parent component. The parent component will still have the position it had before the deletion in the parent component's managed layouts. In this situation, when a deleted node is re-added from the graph, the position specified by the parent component should be used, but there was a bug that prevented this from being used.

We have fixed it and released v0.9.14.

Happy new year @dash14 !
Thank you and your team for the new version.
👍

Thank you for your reaction, @kogratte, @ThuanLCSE !
I will close this issue. If you continue to have problems or questions, please reply to this Issue or submit a new issue.