No new argument for Layer::redraw.

Instead, make _resolution a private property (resolution) which is set to null to make redraw call moveTo with zoomChanged set to true.
This commit is contained in:
ahocevar
2011-12-26 11:09:07 +01:00
parent ff04517232
commit d42eec9775
4 changed files with 21 additions and 15 deletions

View File

@@ -265,6 +265,14 @@ OpenLayers.Layer = OpenLayers.Class({
* {Float}
*/
minResolution: null,
/**
* Property: resolution
* {Float} Current resolution that the layer is drawn in. Used by
* subclasses to determine whether the zoom has changed when calling
* <moveTo>.
*/
resolution: null,
/**
* APIProperty: numZoomLevels
@@ -541,9 +549,7 @@ OpenLayers.Layer = OpenLayers.Class({
* Returns:
* {Boolean} The layer was redrawn.
*/
redraw: function(zoomChanged) {
// zoomChanged forces a zoom change in the layer's moveTo
// call. This isn't documented because not part of the API.
redraw: function() {
var redrawn = false;
if (this.map) {
@@ -554,9 +560,8 @@ OpenLayers.Layer = OpenLayers.Class({
var extent = this.getExtent();
if (extent && this.inRange && this.visibility) {
zoomChanged = zoomChanged ||
this._resolution === undefined ||
this._resolution !== this.map.getResolution();
zoomChanged = this.resolution == null ||
this.resolution !== this.map.getResolution();
this.moveTo(extent, zoomChanged, false);
this.events.triggerEvent("moveend",
{"zoomChanged": zoomChanged});
@@ -581,7 +586,7 @@ OpenLayers.Layer = OpenLayers.Class({
display = display && this.inRange;
}
this.display(display);
this._resolution = this.map.getResolution();
this.resolution = this.map.getResolution();
},
/**
@@ -638,7 +643,7 @@ OpenLayers.Layer = OpenLayers.Class({
// deal with gutters
this.setTileSize();
delete this._resolution;
this.resolution = null;
}
},