make Layer.redraw not unconditionally set zoomChanged to true in moveTo

This commit is contained in:
Éric Lemoine
2011-12-22 14:18:12 +01:00
parent 1284dca5ec
commit 289d9d371d
3 changed files with 106 additions and 5 deletions
+9 -2
View File
@@ -541,7 +541,9 @@ OpenLayers.Layer = OpenLayers.Class({
* Returns:
* {Boolean} The layer was redrawn.
*/
redraw: function() {
redraw: function(zoomChanged) {
// zoomChanged forces a zoom change in the layer's moveTo
// call. This isn't documented because not part of the API.
var redrawn = false;
if (this.map) {
@@ -552,7 +554,9 @@ OpenLayers.Layer = OpenLayers.Class({
var extent = this.getExtent();
if (extent && this.inRange && this.visibility) {
var zoomChanged = true;
zoomChanged = zoomChanged ||
this._resolution === undefined ||
this._resolution !== this.map.getResolution();
this.moveTo(extent, zoomChanged, false);
this.events.triggerEvent("moveend",
{"zoomChanged": zoomChanged});
@@ -577,6 +581,7 @@ OpenLayers.Layer = OpenLayers.Class({
display = display && this.inRange;
}
this.display(display);
this._resolution = this.map.getResolution();
},
/**
@@ -632,6 +637,8 @@ OpenLayers.Layer = OpenLayers.Class({
// deal with gutters
this.setTileSize();
delete this._resolution;
}
},