[OpenLayers-Users] Mouse position control

Jeff Dege jdege at korterra.com
Tue Oct 24 11:53:00 EDT 2006


Don't kick yourself too hard - the description in the doc file dates
from when the granularity setting worked the way you had thought it had
worked.  I updated the code, and forgot to update the docs.

I've submitted a patch to the docs so that the description for the
granularity setting matches what the granularity setting does do,
instead of what it used to do back when the control wasn't working.

And I've bumped the default value from 1 to 10 - which should make even
folks with fast mouses update the display.

You can, if you like, set granularity to > window size, and have it
update the display all the time.  Personally, I really hate jerky mouse
movement, but others might not be as sensitive.

> -----Original Message-----
> From: users-bounces at openlayers.org 
> [mailto:users-bounces at openlayers.org] On Behalf Of Alan U
> Sent: Tuesday, October 24, 2006 10:22 AM
> To: users at openlayers.org
> Subject: Re: [OpenLayers-Users] Mouse position control
> 
> 
> 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.
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 



More information about the Users mailing list