diff --git a/src/ol/Map.js b/src/ol/Map.js index 3242bf5fd5..052f0ca334 100644 --- a/src/ol/Map.js +++ b/src/ol/Map.js @@ -91,6 +91,8 @@ ol.Map.DEFAULT_TILE_SIZE = 256; * @return {ol.Loc} Location. */ ol.Map.prototype.getCenter = function() { + var proj = this.getUserProjection(); + this.center_ = this.center_.transform(proj); return this.center_; }; @@ -201,7 +203,12 @@ ol.Map.prototype.getResolutionForZoom = function(zoom) { * @param {ol.Loc} center Center. */ ol.Map.prototype.setCenter = function(center) { - this.center_ = center; + var proj = center.getProjection(); + if (goog.isNull(proj)) { + proj = this.getUserProjection(); + center.setProjection(proj); + } + this.center_ = center.transform(this.getProjection()); }; diff --git a/test/index.html b/test/index.html index b271f302c1..3e57ae944b 100644 --- a/test/index.html +++ b/test/index.html @@ -9,7 +9,7 @@ - +