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:
@@ -15,6 +15,7 @@ OpenLayers.Control.PanZoomBar.prototype =
|
|||||||
},
|
},
|
||||||
|
|
||||||
draw: function() {
|
draw: function() {
|
||||||
|
this.map.events.register("zoomend", this, this.moveZoomBar);
|
||||||
// initialize our internal div
|
// initialize our internal div
|
||||||
OpenLayers.Control.prototype.draw.apply(this);
|
OpenLayers.Control.prototype.draw.apply(this);
|
||||||
|
|
||||||
@@ -59,6 +60,7 @@ OpenLayers.Control.PanZoomBar.prototype =
|
|||||||
slider.ondblclick = this.doubleClick.bindAsEventListener(slider);
|
slider.ondblclick = this.doubleClick.bindAsEventListener(slider);
|
||||||
slider.div = this.div;
|
slider.div = this.div;
|
||||||
slider.map = this.map;
|
slider.map = this.map;
|
||||||
|
slider.moveZoomBar = this.moveZoomBar;
|
||||||
slider.zIndex = this.div.zIndex + 5;
|
slider.zIndex = this.div.zIndex + 5;
|
||||||
this.div.appendChild(slider);
|
this.div.appendChild(slider);
|
||||||
this.buttons.append(slider);
|
this.buttons.append(slider);
|
||||||
@@ -93,12 +95,16 @@ OpenLayers.Control.PanZoomBar.prototype =
|
|||||||
evt.xy = this.getMousePosition(evt);
|
evt.xy = this.getMousePosition(evt);
|
||||||
var deltaY = this.zoomStart.y - evt.xy.y
|
var deltaY = this.zoomStart.y - evt.xy.y
|
||||||
this.map.zoomTo(this.map.zoom + Math.round(deltaY/15));
|
this.map.zoomTo(this.map.zoom + Math.round(deltaY/15));
|
||||||
this.style.top = (this.map.getZoomLevels() - this.map.getZoom())*15+
|
this.moveZoomBar();
|
||||||
parseInt(document.getElementById("OpenLayers_Control_PanZoomBar_Zoombar").style.top) + 3;
|
|
||||||
this.div.style.cursor="default";
|
this.div.style.cursor="default";
|
||||||
this.mouseDragStart = null;
|
this.mouseDragStart = null;
|
||||||
Event.stop(evt);
|
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) {
|
_addButton:function(id, img, xy, sz) {
|
||||||
var imgLocation = OpenLayers.Util.getImagesLocation() + img;
|
var imgLocation = OpenLayers.Util.getImagesLocation() + img;
|
||||||
// var btn = new ol.AlphaImage("_"+id, imgLocation, xy, sz);
|
// var btn = new ol.AlphaImage("_"+id, imgLocation, xy, sz);
|
||||||
|
|||||||
Reference in New Issue
Block a user