diff --git a/lib/OpenLayers/Control/PanZoomBar.js b/lib/OpenLayers/Control/PanZoomBar.js index 50d506d7f5..c4ed4fcdd6 100644 --- a/lib/OpenLayers/Control/PanZoomBar.js +++ b/lib/OpenLayers/Control/PanZoomBar.js @@ -6,18 +6,18 @@ // OpenLayers.Control.PanZoomBar = Class.create(); OpenLayers.Control.PanZoomBar.prototype = - Object.extend( new OpenLayers.Control(), { + Object.extend( new OpenLayers.Control.PanZoom(), { // Array(...) buttons: null, initialize: function() { - OpenLayers.Control.prototype.initialize.apply(this, arguments); + OpenLayers.Control.PanZoom.prototype.initialize.apply(this, arguments); }, draw: function() { - this.map.events.register("zoomend", this, this.moveZoomBar); // initialize our internal div OpenLayers.Control.prototype.draw.apply(this); + this.map.events.register("zoomend", this, this.moveZoomBar); // place the controls this.buttons = new Array(); @@ -116,78 +116,8 @@ OpenLayers.Control.PanZoomBar.prototype = 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); - var btn = OpenLayers.Util.createImage( - imgLocation, sz, xy, "absolute", - "OpenLayers_Control_PanZoomBar_" + id ); - - //we want to add the outer div - this.div.appendChild(btn); - - btn.onmousedown = this.buttonDown.bindAsEventListener(btn); - btn.ondblclick = this.doubleClick.bindAsEventListener(btn); - btn.action = id; - btn.map = this.map; - - //we want to remember/reference the outer div - this.buttons.push(btn); - return btn; - }, - doubleClick: function (evt) { - Event.stop(evt); - }, - - buttonDown: function (evt) { - switch (this.action) { - case "panup": - var resolution = this.map.getResolution(); - var center = this.map.getCenter(); - this.map.setCenter( - new OpenLayers.LatLon(center.lat + (resolution * 50), - center.lon - ) - ); - break; - case "pandown": - var resolution = this.map.getResolution(); - var center = this.map.getCenter(); - this.map.setCenter( - new OpenLayers.LatLon(center.lat - (resolution * 50), - center.lon - ) - ); - break; - case "panleft": - var resolution = this.map.getResolution(); - var center = this.map.getCenter(); - this.map.setCenter( - new OpenLayers.LatLon(center.lat, - center.lon - (resolution * 50) - ) - ); - break; - case "panright": - var resolution = this.map.getResolution(); - var center = this.map.getCenter(); - this.map.setCenter( - new OpenLayers.LatLon(center.lat, - center.lon + (resolution * 50) - ) - ); - break; - case "zoomin": this.map.zoomIn(); break; - case "zoomout": this.map.zoomOut(); break; - case "zoomextents": this.map.zoomExtent(); break; - } - Event.stop(evt); - }, destroy: function() { - OpenLayers.Control.prototype.destroy.apply(this, arguments); - for(i=0; i