Tuesday, March 22, 2016

Mouse Pointer Location

Friends:

I have a unique problem that's become difficult resolve.  I'm implementing a drawing application that detects mouse actions (down, up, drag, move etc).  The mouse location must be identified constantly (while - mouse moving, mouse clicking, mouse down, mouse up etc).  The location reported is accurate when the x is closer to 0 (when the mouse is closer to the left most border of the drawing area. But when the mouse is closer to the right most border of the drawing area (x is closer to the maximum) the location reported is about 1/4th inch away from the mouse's location.  The reported value always has a lesser x value compared to the actual mouse position.

Here's the code that gets the mouse location -

public static Point getLocation(MouseEvent<?> event) {
       
int x = event.getX();
       
int y = event.getY();
       
return new Point(x, y);
}

This application is running at http://peruselab.com to experiment.  I also have included a couple of screen clips to illustrate the problem.  If a line exists on the screen and if you move the mouse closer to either ends of the line a circle must appear to indicate "snappability".  Actually the difference is gradually increasing from left to right.  That is when the mouse is in the middle of the drawing area then the difference between reported and actual mouse locations is only about 1/8 of an inch.



I'm under the hope that this is a known issue and some one has found a solution.


Thanks in advance.

Velu




--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment