OpenLayers OpenLayers

Ticket #1579: 1579-r7374-A0.patch

File 1579-r7374-A0.patch, 1.1 kB (added by ahocevar, 7 months ago)

a minor modification of the original patch, should increase performance

  • lib/OpenLayers/Handler/Box.js

    old new  
    8484    * Method: moveBox 
    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 
    9997    /**