Skip to content

How to preserve a node position when you nest it (add a parent node) #1202

Answered by Kaua890
DoaaRadwan asked this question in Q&A
Discussion options

You must be logged in to vote

Do this with computedPosition is hard because have to calculate the diff between parent and child positions, so i found a new way much simpler to preserve the child node position:

node.extent = "parent"

node.parentNode = parentNode.id

nextTick(() => (node.extent = undefined))

just set "node.extend" to "parent" before set the "parentNode" and remove later using nextTick, i did this in "onNodeDragStop" event

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@DoaaRadwan
Comment options

@Kaua890
Comment options

Answer selected by DoaaRadwan
@DoaaRadwan
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants