OpenLayers OpenLayers

Ticket #1593: 1593-r7375-A0.patch

File 1593-r7375-A0.patch, 1.3 kB (added by ahocevar, 5 months ago)
  • lib/OpenLayers/Handler/Box.js

    old new  
    9292        this.zoomBox.style.height = Math.max(1, deltaY) + "px"; 
    9393        this.zoomBox.style.left = xy.x < startX ? xy.x+"px" : startX+"px"; 
    9494        this.zoomBox.style.top = xy.y < startY ? xy.y+"px" : startY+"px"; 
     95 
     96        // depending on the box model, modify width and height to take borders 
     97        // of the box into account 
     98        var dimensions = OpenLayers.Element.getDimensions(this.zoomBox); 
     99        if (dimensions.width != deltaX || dimensions.height != deltaY) { 
     100            var offsetX = parseInt(OpenLayers.Element.getStyle(this.zoomBox, 
     101                "border-left-width")) + parseInt(OpenLayers.Element.getStyle( 
     102                this.zoomBox, "border-right-width")); 
     103            var offsetY = parseInt(OpenLayers.Element.getStyle(this.zoomBox, 
     104                "border-top-width")) + parseInt(OpenLayers.Element.getStyle( 
     105                this.zoomBox, "border-bottom-width")); 
     106            this.zoomBox.style.width = Math.max(1, deltaX - offsetX) + "px"; 
     107            this.zoomBox.style.height = Math.max(1, deltaY - offsetY) + "px"; 
     108        } 
    95109    }, 
    96110 
    97111    /**