Hi @vasturiano,
I’m currently working with Force Graph 2D and trying to implement a custom drag interaction where:
- When a user starts dragging a node, instead of moving the original node, a new node is created connected to the original,
- The drag then continues with this newly created node following the cursor,
- While the original node remains fixed in place.
Right now, the library provides onNodeDrag and onNodeDragEnd callbacks, but there’s no onNodeDragStart exposed.
I’m wondering if exposing onNodeDragStart would make it possible to implement this behavior? Or if there’s another way to programmatically transfer drag control to a different node mid-drag?
The main challenge is that the drag events are managed internally by d3-drag, and I couldn't find a way to intercept or reassign the dragging to a different node once started.
I plan to allow both drag types by implementing two distinct modes: one for moving existing nodes around, and another dedicated to adding nodes via drag.
Any advice, or plans to expose this event or add a way to control drag behavior would be greatly appreciated.
Thanks for the great library and for considering this!
Hi @vasturiano,
I’m currently working with Force Graph 2D and trying to implement a custom drag interaction where:
Right now, the library provides
onNodeDragandonNodeDragEndcallbacks, but there’s noonNodeDragStartexposed.I’m wondering if exposing
onNodeDragStartwould make it possible to implement this behavior? Or if there’s another way to programmatically transfer drag control to a different node mid-drag?The main challenge is that the drag events are managed internally by d3-drag, and I couldn't find a way to intercept or reassign the dragging to a different node once started.
I plan to allow both drag types by implementing two distinct modes: one for moving existing nodes around, and another dedicated to adding nodes via drag.
Any advice, or plans to expose this event or add a way to control drag behavior would be greatly appreciated.
Thanks for the great library and for considering this!