"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)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@7375 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2008-06-18 09:33:55 +00:00
parent 4340867918
commit 9724b0a214

View File

@@ -84,16 +84,14 @@ OpenLayers.Handler.Box = OpenLayers.Class(OpenLayers.Handler, {
* Method: moveBox
*/
moveBox: function (xy) {
var deltaX = Math.abs(this.dragHandler.start.x - xy.x);
var deltaY = Math.abs(this.dragHandler.start.y - xy.y);
var startX = this.dragHandler.start.x;
var startY = this.dragHandler.start.y;
var deltaX = Math.abs(startX - xy.x);
var deltaY = Math.abs(startY - xy.y);
this.zoomBox.style.width = Math.max(1, deltaX) + "px";
this.zoomBox.style.height = Math.max(1, deltaY) + "px";
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";
}
this.zoomBox.style.left = xy.x < startX ? xy.x+"px" : startX+"px";
this.zoomBox.style.top = xy.y < startY ? xy.y+"px" : startY+"px";
},
/**