[OpenLayers-Users] Mouse position control

Alan U alan.underwood at hotmail.co.uk
Tue Oct 24 11:22:16 EDT 2006


I take it all back (almost!)
There isn't necessarily a problem with the code, but I always have my mouse
on fast pointer movement. This was never giving me a mouse-movement < 2
pixels.

DOH!!

Turning down the sensitivity of my mouse and the code works (of course). It
only updates the control display if the mouse-movement is small enough and
mine wasn't.
Therefore, the default granularity should be raised or anyone running the
examples/default code will see no feed back from the mousePosition control!
My final points about not being able to get latlong values when moving the
mouse slowly are rubbish too.

Alan (gently kicking myself)




Alan U wrote:
> 
> Taking the code from the trunk, the mouse position control seems a bit
> wrong. I was getting no feedback in FF and only feedback in IE when making
> a click on the map.
> 
> In the redraw function I changed:
> 
>             if (this.lastXy == null ||
>                 Math.abs(evt.xy.x - this.lastXy.x) > this.granularity ||
>                 Math.abs(evt.xy.y - this.lastXy.y) > this.granularity)
>             { //don't update
> 
> to:
>             if (this.lastXy == null ||
>                 Math.abs(evt.xy.x - this.lastXy.x) < this.granularity ||
>                 Math.abs(evt.xy.y - this.lastXy.y) < this.granularity)
>             {//don't update
> 
> Note the greater/less than signs.
> 
> Also, with the granularity value even set to 1, moving slowly across the
> map causes no update of the xy coords in the control. Though this is
> designed for, it is not intuitive imo. If you are trying to get a
> coordinate precisely, then it is highly likely you will be moving the
> mouse below the granularity level: thus I think the default should be 0.
> 
> Alan
> 

-- 
View this message in context: http://www.nabble.com/Mouse-position-control-tf2501061.html#a6974998
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list