[OpenLayers-Users] Mouse position control

Alan U alan.underwood at hotmail.co.uk
Tue Oct 24 08:51:25 EDT 2006


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.




More information about the Users mailing list