Respect zoom level restriction.
This commit is contained in:
@@ -99,6 +99,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||
|
||||
this.map.events.un({
|
||||
"changebaselayer": this.redraw,
|
||||
"resize": this.redraw,
|
||||
scope: this
|
||||
});
|
||||
|
||||
@@ -116,7 +117,11 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||
*/
|
||||
setMap: function(map) {
|
||||
OpenLayers.Control.PanZoom.prototype.setMap.apply(this, arguments);
|
||||
this.map.events.register("changebaselayer", this, this.redraw);
|
||||
this.map.events.on({
|
||||
"changebaselayer": this.redraw,
|
||||
"resize": this.redraw,
|
||||
scope: this
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -189,6 +194,10 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||
_addZoomBar:function(centered) {
|
||||
var imgLocation = OpenLayers.Util.getImageLocation("slider.png");
|
||||
var id = this.id + "_" + this.map.id;
|
||||
var minZoom = 0;
|
||||
if (this.map.baseLayer && this.map.baseLayer.wrapDateLine) {
|
||||
minZoom = this.map.adjustZoom(0);
|
||||
}
|
||||
var zoomsToEnd = this.map.getNumZoomLevels() - 1 - this.map.getZoom();
|
||||
var slider = OpenLayers.Util.createAlphaImageDiv(id,
|
||||
centered.add(-1, zoomsToEnd * this.zoomStopHeight),
|
||||
@@ -211,7 +220,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||
|
||||
var sz = {
|
||||
w: this.zoomStopWidth,
|
||||
h: this.zoomStopHeight * this.map.getNumZoomLevels()
|
||||
h: this.zoomStopHeight * (this.map.getNumZoomLevels() - minZoom)
|
||||
};
|
||||
var imgLocation = OpenLayers.Util.getImageLocation("zoombar.png");
|
||||
var div = null;
|
||||
@@ -242,7 +251,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||
this.map.events.register("zoomend", this, this.moveZoomBar);
|
||||
|
||||
centered = centered.add(0,
|
||||
this.zoomStopHeight * this.map.getNumZoomLevels());
|
||||
this.zoomStopHeight * (this.map.getNumZoomLevels() - minZoom));
|
||||
return centered;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user