Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose drag-and-drop clientX and clientY #189

Open
joeyh opened this issue May 28, 2017 · 1 comment
Open

expose drag-and-drop clientX and clientY #189

joeyh opened this issue May 28, 2017 · 1 comment

Comments

@joeyh
Copy link

joeyh commented May 28, 2017

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
Copy link
Author

joeyh commented May 28, 2017

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.

joeyh added a commit to joeyh/threepenny-gui that referenced this issue May 28, 2017
Available in all drag and drop events except for dragEnd.

Closes HeinrichApfelmus#189
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants