center returned in user projection

This commit is contained in:
Mike Adair
2012-06-20 09:02:20 -04:00
parent 09a6b6c456
commit aa584e17e9
2 changed files with 9 additions and 2 deletions

View File

@@ -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());
};

View File

@@ -9,7 +9,7 @@
<script type="text/javascript" src="jasmine-1.2.0/jasmine-html.js"></script>
<!-- include source files here... -->
<script type="text/javascript" src="http://localhost:9810/compile?id=ol&amp;mode=SIMPLE"></script>
<script type="text/javascript" src="http://localhost:9810/compile?id=ol&amp;mode=RAW"></script>
<!-- common jasmine extensions -->
<script type="text/javascript" src="jasmine-extensions.js"></script>