HeinrichApfelmus / threepenny-gui

GUI framework that uses the web browser as a display.
https://heinrichapfelmus.github.io/threepenny-gui/
Other
437 stars 77 forks source link

expose drag-and-drop clientX and clientY #189

Open joeyh opened 7 years ago

joeyh commented 7 years ago

html5 drag and drop events have clientX and clientY values, could these be exposed in some way?

I tried using mousemove to get the position, but during a d-n-d operation, that event doesn't fire.

DragData could be extended to include that information, but that feels wrong, since "dragdata" has a specific meaning in html5. Also some drag events don't get clientX and clientY, in particular dragend does not. How about instead adding the coordinates to events like this:

drop :: Element -> Event (DragData, (Int, Int))
joeyh commented 7 years ago

An example use of this would be a game where objects are thrown around using drag and drop. By watching the mouse position, direction and speed can be calculated, so the object keeps moving after it's dropped.