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

Eric Lemoine eric.c2c at gmail.com
Sun Jun 8 16:05:59 EDT 2008


2008/6/5 Andrea Di Nora <seldoran at gmail.com>:
> 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.

Hi Andrea

It took me a while to understand and reproduce the problem. I got it
now! Your patch looks good. Could you please open ticket and attach
your patch to it? If your patch include unit tests, I'll review it and
commit it into trunk, if not it'll have to wait until I find time to
write the unit tests.

Thanks for catching this problem and providing a patch.

--
Eric



More information about the Dev mailing list