Mouse location on image

I have a GWT container with some materials in it and an image that is added by a click manipulator.

What I'm trying to do is get the exact X and Y coordinates of the mouse relative to the image. I saw a message here but this is not what I want.

As far as I can see, I have an option, for example, to get the absolute location of the image and the place of the event, but this only works if the user does not scroll down the page.

event.getNativeEvent().getClientY()- image.getElement().getAbsoluteTop(); 
+4
source share
1 answer

Thanks Samuel

here is the solution

 event.getNativeEvent().getClientY()- image.getAbsoluteTop() + Document.get().getScrollTop() 
+1
source

All Articles