anseki / plain-draggable

The simple and high performance library to allow HTML/SVG element to be dragged.
https://anseki.github.io/plain-draggable/
MIT License
773 stars 99 forks source link

Batch move by drag & drop #143

Closed kanban3333 closed 12 months ago

kanban3333 commented 1 year ago

Hi, I am looking to combine plain-draggable and leader-line to create the following process.  1. Drag the mouse to select multiple blocks  2. Move all selected blocks at once by drag & drop   ※If a line is drawn on the block at this time, the position of the line is also updated.  3. Multiple selection of the moved blocks will be deselected and they can be moved individually.   I have tried everything, but cannot get it to work. Can it be implemented in the first place? I would appreciate it if you could tell me. ※I translated it into English using a tool. Sorry for the funny parts.)

Here is a sample we created. https://jsfiddle.net/kanban3333/6a9odcxb/13/

anseki commented 1 year ago

Hi @kanban3333, thank you for the comment. To synchronize those, you can use onMove* event listeners of PlainDraggable instance instead of mousemove event listener. Also, left and top properties of the instance (not CSS properties) allow you to move the item correctly in consideration of the container. For example: https://jsfiddle.net/8hsc6dj4/

kanban3333 commented 1 year ago

Thank you for the great sample.

I am sorry, but due to my technical difficulties, I am having a hard time selecting a batch of objects to move by dragging and deselecting the batch after the move.

I may have other questions, so please give me a little more time.

kanban3333 commented 12 months ago

これ以上時間を掛ける訳にはいかないのでここで完了にしたいと思います。

助けてくれてありがとうございます!

anseki commented 12 months ago

😄