Merge pull request #116 from elemoine/redraw

make Layer.redraw not unconditionally set zoomChanged to true when calling Layer.moveTo
This commit is contained in:
Éric Lemoine
2012-01-13 08:37:09 -08:00
5 changed files with 119 additions and 7 deletions
+15 -1
View File
@@ -265,6 +265,16 @@ OpenLayers.Layer = OpenLayers.Class({
* {Float}
*/
minResolution: null,
/**
* Property: resolution
* {Float} Current resolution that the layer is drawn in. This is
* used to determine whether the zoom has changed when calling
* <moveTo> from <redraw>. Subclasses may set this.resolution to
* null prior to calling redraw to force passing zoomChanged
* true to moveTo.
*/
resolution: null,
/**
* APIProperty: numZoomLevels
@@ -552,7 +562,8 @@ OpenLayers.Layer = OpenLayers.Class({
var extent = this.getExtent();
if (extent && this.inRange && this.visibility) {
var zoomChanged = true;
zoomChanged = this.resolution == null ||
this.resolution !== this.map.getResolution();
this.moveTo(extent, zoomChanged, false);
this.events.triggerEvent("moveend",
{"zoomChanged": zoomChanged});
@@ -577,6 +588,7 @@ OpenLayers.Layer = OpenLayers.Class({
display = display && this.inRange;
}
this.display(display);
this.resolution = this.map.getResolution();
},
/**
@@ -632,6 +644,8 @@ OpenLayers.Layer = OpenLayers.Class({
// deal with gutters
this.setTileSize();
this.resolution = null;
}
},
+2 -1
View File
@@ -120,6 +120,7 @@ OpenLayers.Layer.HTTPRequest = OpenLayers.Class(OpenLayers.Layer, {
*/
mergeNewParams:function(newParams) {
this.params = OpenLayers.Util.extend(this.params, newParams);
this.resolution = null;
var ret = this.redraw();
if(this.map != null) {
this.map.events.triggerEvent("changelayer", {
@@ -144,7 +145,7 @@ OpenLayers.Layer.HTTPRequest = OpenLayers.Class(OpenLayers.Layer, {
if (force) {
return this.mergeNewParams({"_olSalt": Math.random()});
} else {
return OpenLayers.Layer.prototype.redraw.apply(this, []);
return OpenLayers.Layer.prototype.redraw.call(this);
}
},