Merge branch 'upstream-master' into deprecated.js

This commit is contained in:
fredj
2011-11-18 12:14:45 +01:00
7 changed files with 76 additions and 21 deletions

View File

@@ -85,7 +85,7 @@ OpenLayers.Control = OpenLayers.Class({
/**
* Property: allowSelection
* {Boolean} By deafault, controls do not allow selection, because
* {Boolean} By default, controls do not allow selection, because
* it may interfere with map dragging. If this is true, OpenLayers
* will not prevent selection of the control.
* Default is false.

View File

@@ -1701,6 +1701,30 @@ OpenLayers.Map = OpenLayers.Class({
this.events.triggerEvent("move");
}
},
/**
* Method: adjustZoom
*
* Parameters:
* zoom - {Number} The zoom level to adjust
*
* Returns:
* {Integer} Adjusted zoom level that shows a map not wider than its
* <baseLayer>'s maxExtent.
*/
adjustZoom: function(zoom) {
var resolution, resolutions = this.baseLayer.resolutions,
maxResolution = this.getMaxExtent().getWidth() / this.getSize().w;
if (this.getResolutionForZoom(zoom) > maxResolution) {
for (var i=zoom|0, ii=resolutions.length; i<ii; ++i) {
if (resolutions[i] <= maxResolution) {
zoom = i;
break;
}
}
}
return zoom;
},
/**
* Method: moveTo
@@ -1723,6 +1747,9 @@ OpenLayers.Map = OpenLayers.Class({
zoom = Math.round(zoom);
}
}
if (this.baseLayer.wrapDateLine) {
zoom = this.adjustZoom(zoom);
}
// dragging is false by default
var dragging = options.dragging || this.dragging;
// forceZoomChange is false by default