If map.maxResolution is not set, set it to display the entire maxExtent in whatever the current map size is by default.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@301 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Schuyler Erle
2006-05-23 22:41:28 +00:00
parent 92571569af
commit 45fc70cbc7

View File

@@ -23,14 +23,12 @@ OpenLayers.Map.prototype = {
// OpenLayers.Bounds // OpenLayers.Bounds
maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90), maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90),
/* maxScale was determined empirically by finding the resolution
of GMaps in degrees per pixel at zoom level 0. */
// float
maxResolution: .3515625, // degrees per pixel
/* projection */ /* projection */
projection: "EPSG:4326", projection: "EPSG:4326",
// float
maxResolution: null, // degrees per pixel
// DOMElement: the div that our map lives in // DOMElement: the div that our map lives in
div: null, div: null,
@@ -78,7 +76,6 @@ OpenLayers.Map.prototype = {
this.viewPortDiv.style.position = "relative"; this.viewPortDiv.style.position = "relative";
this.div.appendChild(this.viewPortDiv); this.div.appendChild(this.viewPortDiv);
// the layerContainerDiv is the one that holds all the layers // the layerContainerDiv is the one that holds all the layers
this.layerContainerDiv = OpenLayers.Util.createDiv( this.layerContainerDiv = OpenLayers.Util.createDiv(
div.id + "_OpenLayers_Container" ); div.id + "_OpenLayers_Container" );
@@ -87,6 +84,12 @@ OpenLayers.Map.prototype = {
this.events = new OpenLayers.Events(this, div, this.EVENT_TYPES); this.events = new OpenLayers.Events(this, div, this.EVENT_TYPES);
this.updateSize(); this.updateSize();
// make the entire maxExtent fix in zoom level 0 by default
if (this.maxResolution == null) {
this.maxResolution = Math.max(
this.maxExtent.getWidth() / this.size.w,
this.maxExtent.getHeight() / this.size.h );
}
// update the internal size register whenever the div is resized // update the internal size register whenever the div is resized
this.events.register("resize", this, this.updateSize); this.events.register("resize", this, this.updateSize);