Skip to content

Commit

Permalink
Merge pull request openlayers#1163 from sbrunner/change-baselayer-rel…
Browse files Browse the repository at this point in the history
…oad-overlays

Don't reload all the overlays if the resolution don't change
  • Loading branch information
sbrunner committed Nov 25, 2013
2 parents a0cdd3f + df549e5 commit fe58275
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/OpenLayers/Map.js
Expand Up @@ -1284,6 +1284,7 @@ OpenLayers.Map = OpenLayers.Class({

// preserve center and scale when changing base layers
var center = this.getCachedCenter();
var oldResolution = this.getResolution();
var newResolution = OpenLayers.Util.getResolutionFromScale(
this.getScale(), newBaseLayer.units
);
Expand Down Expand Up @@ -1312,7 +1313,7 @@ OpenLayers.Map = OpenLayers.Class({
newResolution || this.resolution, true
);
// zoom and force zoom change
this.setCenter(center, newZoom, false, true);
this.setCenter(center, newZoom, false, oldResolution != newResolution);
}

this.events.triggerEvent("changebaselayer", {
Expand Down

0 comments on commit fe58275

Please sign in to comment.