diff --git a/lib/OpenLayers/Control/PanZoomBar.js b/lib/OpenLayers/Control/PanZoomBar.js index 11298375e6..fc47c59f23 100644 --- a/lib/OpenLayers/Control/PanZoomBar.js +++ b/lib/OpenLayers/Control/PanZoomBar.js @@ -15,6 +15,7 @@ OpenLayers.Control.PanZoomBar.prototype = }, draw: function() { + this.map.events.register("zoomend", this, this.moveZoomBar); // initialize our internal div OpenLayers.Control.prototype.draw.apply(this); @@ -59,6 +60,7 @@ OpenLayers.Control.PanZoomBar.prototype = slider.ondblclick = this.doubleClick.bindAsEventListener(slider); slider.div = this.div; slider.map = this.map; + slider.moveZoomBar = this.moveZoomBar; slider.zIndex = this.div.zIndex + 5; this.div.appendChild(slider); this.buttons.append(slider); @@ -93,12 +95,16 @@ OpenLayers.Control.PanZoomBar.prototype = evt.xy = this.getMousePosition(evt); var deltaY = this.zoomStart.y - evt.xy.y this.map.zoomTo(this.map.zoom + Math.round(deltaY/15)); - this.style.top = (this.map.getZoomLevels() - this.map.getZoom())*15+ - parseInt(document.getElementById("OpenLayers_Control_PanZoomBar_Zoombar").style.top) + 3; + this.moveZoomBar(); this.div.style.cursor="default"; this.mouseDragStart = null; Event.stop(evt); }, + moveZoomBar:function() { + var slider = $('OpenLayers_Control_PanZoomBar_Slider'); + slider.style.top = (this.map.getZoomLevels() - this.map.getZoom())*15+ + parseInt(document.getElementById("OpenLayers_Control_PanZoomBar_Zoombar").style.top) + 3; + }, _addButton:function(id, img, xy, sz) { var imgLocation = OpenLayers.Util.getImagesLocation() + img; // var btn = new ol.AlphaImage("_"+id, imgLocation, xy, sz);