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
Please describe the feature that you want to propose
I'm trying to use the Add Node On Edge Drop example and have the newNode add a parentNode: connectingNodeId.current prop so it will automatically belong to its parent.
But I can't figure out how to calculate the relative position because event.clientX is the absolute position which is not the one I need when it uses the parentNode's relative position.
I would like a way to get the relative position or to subtract the parentNode's x/y coords somehow?
I saw this issue #3393 but I don't want to use absolute positioning for the grouped/parented nodes.
It could be achieved if the OnConnectEnd event would have a node besides the event from which I could simply extract the position or 'absolutePosition` from. That node would be the node that I connect from.
/Update
I've tried to use useRef to store the origin node and calculate the position, but I can't get it to work right
The text was updated successfully, but these errors were encountered:
TrySpace
changed the title
Get relative node position on Edge Drop for grouped nodes
Get relative node position on Edge Drop for new node with parentNode
Apr 13, 2024
Please describe the feature that you want to propose
I'm trying to use the Add Node On Edge Drop example and have the newNode add a
parentNode: connectingNodeId.current
prop so it will automatically belong to its parent.But I can't figure out how to calculate the relative position because
event.clientX
is the absolute position which is not the one I need when it uses the parentNode's relative position.I would like a way to get the relative position or to subtract the parentNode's x/y coords somehow?
I saw this issue #3393 but I don't want to use absolute positioning for the grouped/parented nodes.
See sandbox
It could be achieved if the
OnConnectEnd
event would have anode
besides theevent
from which I could simply extract theposition
or 'absolutePosition` from. That node would be the node that I connect from./Update
I've tried to use
useRef
to store the origin node and calculate the position, but I can't get it to work rightThe text was updated successfully, but these errors were encountered: