[OpenLayers-Users] Mouse position control

Jeff Dege jdege at korterra.com
Tue Oct 24 10:42:46 EDT 2006


I think you're mistaking what the granularity setting is supposed to do.

Updating the LonLat values on the page takes time.  If you do it while
the mouse is moving quickly, it makes the mouse jerky.

So the code was written that if the mouse had moved more than the
specified number of pixels, the display would not be updated, until the
mouse had come back to rest.

So if it's working properly, you should see the display continuously
update when the mouse is moving slowly, and not when the mouse is moving
quickly.  And for that to happen, you want '>'s, not '<'s.

On the other hand, your initial problem, "I was getting no feedback in
FF and only feedback in IE when making a click on the map" - baffles me.
I tested this in IE6 and FF1.5 on Windows, and in FF1.5 on Linux, and
saw no difference in behavior.

What version of OpenLayers are you running?

> -----Original Message-----
> From: users-bounces at openlayers.org 
> [mailto:users-bounces at openlayers.org] On Behalf Of Alan U
> Sent: Tuesday, October 24, 2006 7:51 AM
> To: users at openlayers.org
> Subject: [OpenLayers-Users] Mouse position control
> 
> 
> 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#a6972149
> 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