Mouse click location on an image
I have a GWT container with some stuff in it and an image which is added a clickhandler.
What I try to do is to get the exact mouse event's X and Y coordinates relative to the image. I saw the post here but this is not what I want.
As far as I can see, I have option like getting the image absolute location and event locat开发者_JAVA百科ion but this works only if the user doesn't scroll down the page.
event.getNativeEvent().getClientY()- image.getElement().getAbsoluteTop();
Thanks to Samuel,
here is the solution
event.getNativeEvent().getClientY()- image.getAbsoluteTop() + Document.get().getScrollTop()
精彩评论