[OpenLayers-Dev] Draw bug in OpenLayers.Handler.Box with firefox

Andrea Di Nora seldoran at gmail.com
Thu Jun 5 04:33:59 EDT 2008


Hi. I've found a problem in OpenLayers.Handler.Box; when you draw a box and
move fast from negative to positive coordinates in firefox, the mouse cursor
do not follow exactly the box.
The code that give problem is :

       if (xy.x < this.dragHandler.start.x) {
           this.zoomBox.style.left = xy.x+"px";
       }
       if (xy.y < this.dragHandler.start.y) {
           this.zoomBox.style.top = xy.y+"px";
       }

if i move mouse very fast, firefox lost some events and the top/left value
remain with old values also if i go in positive area.
A possible solution is :

       if (xy.x < this.dragHandler.start.x) {
           this.zoomBox.style.left = xy.x+"px";
       }
       else{
           this.zoomBox.style.left = this.dragHandler.start.x+"px";
       }
       if (xy.y < this.dragHandler.start.y) {
           this.zoomBox.style.top = xy.y+"px";
       }
       else{
           this.zoomBox.style.top = this.dragHandler.start.y+"px";
       }


Andrea Di Nora.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20080605/7c4425f2/attachment.html


More information about the Dev mailing list