retejs / dock-plugin

https://retejs.org
MIT License
5 stars 18 forks source link

pointer doesn't get updated on drop #29

Closed fredericrous closed 9 months ago

fredericrous commented 10 months ago

When I drop a node and get the nodecreated event, I expect area.area.pointer to return the position of the mouse. However it gets me the position of where I started my drag-and-drop operation on the dock.

You can observe the issue with this code

  editor.addPipe((context) => {
    if (context.type === 'nodecreated') {
      console.log(area.area.pointer);
    }
  });

I believe it is due to how the browser handles drag/drop. Indeed try this code:

  window.document.addEventListener('pointermove', (e) => {
    console.log(e.clientX, e.clientY)
  });

use case: I want to know on which existing node I dropped the node from the dock

is my workaround correct?: I listen on dragover event with a debounce

Ni55aN commented 9 months ago

Is this issue still relevant?

fredericrous commented 9 months ago

you can close it. the workaround is good enough