Hi,
Sometimes I see strange behaviour of the ZoomIn/ZoomOut tools: ZoomOut miss
mouse clicks, or ZoomIn set unreal large scale when we use one mouse
click(not a click-and-drag area).
I found that its happen because sometimes instead
onMousePressed->onMouseReleased->onMouseClicked events we receive
onMousePressed->onMouseDragged->onMouseReleased events with 1-2 points
offset.
Dont't know where is the origin of this bug - Java, WindowsXP, geotools,
mouse drivers or hardware (I saw this with any version of the geoools and a
large number of WindowsXP computers).
I fix this situation for ZoomOut and ZoomIn tools:
ZoomOutTool - just move onMouseClicked code to onMouseReleased method.
ZoomInTool - adding startDragPoint variable to the class, set its value in
onMousePressed method and adding following code to the onMouseReleased
method:
...
if ( isContactBounce( startDragPoint, ev.getPoint() ) ) {
dragged = false;
onMouseClicked(ev);
return;
}
...
boolean isContactBounce(Point startMousePos, Point stopMousePos){
int xDelta = (int)Math.abs(startMousePos.getX() - stopMousePos.getX());
int yDelta = (int)Math.abs(startMousePos.getY() - stopMousePos.getY());
if( xDelta <= 1 || yDelta <=1 ) return true;
return false;
}
...
I'm new to geotools, maybe it makes sense to add these changes to the
geotools sources?
Thanks,
Michael Grain
--
View this message in context:
http://n2.nabble.com/JMapPane-onMouseDragged-instead-onMouseClicked-tp4912473p4912473.html
Sent from the geotools-devel mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel