OpenLayers OpenLayers

Changeset 7375

Show
Ignore:
Timestamp:
06/18/08 05:33:55 (2 months ago)
Author:
ahocevar
Message:

"Draw bug in OpenLayers.Handler.Box with firefox". Now always set style.left and style.top, so lost events won't result in an incorrect box any more. r=me (closes #1579)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Handler/Box.js

    r5614 r7375  
    8585    */ 
    8686    moveBox: function (xy) { 
    87         var deltaX = Math.abs(this.dragHandler.start.x - xy.x); 
    88         var deltaY = Math.abs(this.dragHandler.start.y - xy.y); 
     87        var startX = this.dragHandler.start.x; 
     88        var startY = this.dragHandler.start.y; 
     89        var deltaX = Math.abs(startX - xy.x); 
     90        var deltaY = Math.abs(startY - xy.y); 
    8991        this.zoomBox.style.width = Math.max(1, deltaX) + "px"; 
    9092        this.zoomBox.style.height = Math.max(1, deltaY) + "px"; 
    91         if (xy.x < this.dragHandler.start.x) { 
    92             this.zoomBox.style.left = xy.x+"px"; 
    93         } 
    94         if (xy.y < this.dragHandler.start.y) { 
    95             this.zoomBox.style.top = xy.y+"px"; 
    96         } 
     93        this.zoomBox.style.left = xy.x < startX ? xy.x+"px" : startX+"px"; 
     94        this.zoomBox.style.top = xy.y < startY ? xy.y+"px" : startY+"px"; 
    9795    }, 
    9896