jerosoler / Drawflow

Simple flow library 🖥️🖱️
https://jerosoler.github.io/Drawflow/
MIT License
4.65k stars 722 forks source link

How can I paste multiple nodes at the mouse cursor position in another module? #662

Open boyag99 opened 1 year ago

boyag99 commented 1 year ago

Hi!

I am facing a problem with copying multiple nodes to another module with different scale transforms. How can I paste multiple nodes at the mouse cursor position with different scale transforms but still keep the distance between the nodes?

jerosoler commented 1 year ago

Hello

I don't know how it is copying the nodes.

But I guess it's the same problem as in the Demo, to find the correct position on drop.

View File: https://github.com/jerosoler/Drawflow/blob/master/docs/index.html

      pos_x = pos_x * ( editor.precanvas.clientWidth / (editor.precanvas.clientWidth * editor.zoom)) - (editor.precanvas.getBoundingClientRect().x * ( editor.precanvas.clientWidth / (editor.precanvas.clientWidth * editor.zoom)));
      pos_y = pos_y * ( editor.precanvas.clientHeight / (editor.precanvas.clientHeight * editor.zoom)) - (editor.precanvas.getBoundingClientRect().y * ( editor.precanvas.clientHeight / (editor.precanvas.clientHeight * editor.zoom)));