Drawflow icon indicating copy to clipboard operation
Drawflow copied to clipboard

Restrict node overlap while dragging existing node and new node

Open Sri-5555 opened this issue 3 years ago • 3 comments

How to restrict overlap of node while dragging existing or adding new node over other node overlap node

Sri-5555 avatar Jun 24 '22 07:06 Sri-5555

By default there is nothing implemented. But what would have to be done is to detect the collisions.

https://developer.mozilla.org/en-US/docs/Games/Techniques/2D_collision_detection

You could use the events of "nodeCreated", "nodeMoved". To detect when a node is created or moved.

Once this is done, detect if there is a collision and if there is, move the node.

Move node with javascript:

  • https://github.com/jerosoler/Drawflow/issues/112

jerosoler avatar Jun 25 '22 09:06 jerosoler

Hi @jerosoler can you please help me that how can i get position of any node in drawflow when i move using (nodeMoved event) so i can manage collision detaction

Thanks

codeandcore avatar Aug 29 '22 07:08 codeandcore

Use editor.export() to gell all info.

Or document.querySelectorAll(".drawflow-node "); and get left and top position

jerosoler avatar Aug 29 '22 07:08 jerosoler

is there any sample code for this? could you please share it here

vnomohan avatar Nov 16 '23 07:11 vnomohan