Register 'zoomend' event. Use zoomend event registration to move zoomer when zoom level changes. And it even works right.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@78 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2006-05-17 02:48:18 +00:00
parent 5a739abc8e
commit 90460002cb

View File

@@ -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);