You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am making something where nodes can added and removed over time.
When the array supplied to cola.nodes is not the exact same, newly added nodes can collide with other nodes.
Example:
The node with "bug" label can overlap with other nodes. https://jsfiddle.net/y1pwLxht/
Notice that I am cloning the array passed to the .nodes function.
cola
.nodes([].concat(graph.nodes))
.links([].concat(graph.links))
.start();
It works without the copy. This is important because I actually have to store the nodes inside a Object so I can remove them over time. And I pass the return value of Object.values to the .nodes function
Workaround I found:
this.nodeList.splice(0, this.nodeList.length);
this.nodeList.push.apply(this.nodeList, Object.values(this.graph.nodes));
cola
.nodes(this.nodeList)
.links(edgeList)
.start()
The trick here is that this.nodeList is always the same array object.
The text was updated successfully, but these errors were encountered:
I am making something where nodes can added and removed over time.
When the array supplied to
cola.nodes
is not the exact same, newly added nodes can collide with other nodes.Example:
The node with "bug" label can overlap with other nodes.
https://jsfiddle.net/y1pwLxht/
Notice that I am cloning the array passed to the
.nodes
function.It works without the copy. This is important because I actually have to store the nodes inside a Object so I can remove them over time. And I pass the return value of
Object.values
to the .nodes functionWorkaround I found:
The trick here is that
this.nodeList
is always the same array object.The text was updated successfully, but these errors were encountered: