D3 force directed graph with drag and drop support to make selected node position fixed when dropped

后端 未结 1 439
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-05 00:49

Example on a force direct graph can be found here: http://bl.ocks.org/950642

How can I easily add support for drag and drop? It should set the node to fixed with cur

相关标签:
1条回答
  • 2020-12-05 01:15

    Finally got it working after figuring out it is not ideal to fight with two "drag" listeners (your own, and force.drag) attached to the nodes!

    Much better to only have your own "drag"-listener and call tick() manually which is the key feature of getting the force graph to position the nodes for you on every new node position on the node your dragging.

    Working example: http://bl.ocks.org/2883411

    0 讨论(0)
提交回复
热议问题