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 #190

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

joeyh
Copy link

@joeyh joeyh commented May 28, 2017

Available in all drag and drop events except for dragEnd.

Closes #189

Available in all drag and drop events except for dragEnd.

Closes HeinrichApfelmus#189
@sjakobi
Copy link
Collaborator

sjakobi commented Sep 26, 2018

This looks very reasonable to me. Can you give your approval, @HeinrichApfelmus?

@sjakobi
Copy link
Collaborator

sjakobi commented Sep 26, 2018

CI may fail but this builds fine on my machine.

I think what's missing is that ClientXY should be exported?!

@HeinrichApfelmus
Copy link
Owner

Getting X and Y coordinates from a drag event seems useful.

However, there are two issues with this implementation:

  • It turns out that clientX/Y is relative to the top-left corner of the display in the browser, but this need not coincide with the top-left corner of the HTML page if the use has scrolled the page vertically! We use

      var offset = $(this).offset();
      var x      = e.pageX - offset.left;
    

    for the mouse click events, but I do not know if we can obtain offset in the same way for drag events.

  • The use of read and toString() is unsatisfactory. We can marshal JSON values, so it would be more appropriate to express the argument to fun as a JSON value and read its fields on the Haskell side.

I'm happy to look into this if no one else calls dibs, but it may take another day or two.

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

Successfully merging this pull request may close these issues.

3 participants