New node always appear in the center

65 Views Asked by At

Given the following:

const nodes = new DataView(nodeData);

// Somewhere in the code, I call this to add new node whenever I click on a node
nodes.add({id: 1, label: "newNode"});

My issue is, when the new node is added, it always appear at the center. What I want is for the new node to first appear near the node that I clicked cause I want to connect that new node to the node that I selected. But when the new node appears, I don't want it to stick on that position, cause I want it to adjust since I enable the physics, the new node should adjust it's distance from the selected node.

0

There are 0 best solutions below