center returned in user projection
This commit is contained in:
@@ -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());
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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&mode=SIMPLE"></script>
|
||||
<script type="text/javascript" src="http://localhost:9810/compile?id=ol&mode=RAW"></script>
|
||||
|
||||
<!-- common jasmine extensions -->
|
||||
<script type="text/javascript" src="jasmine-extensions.js"></script>
|
||||
|
||||
Reference in New Issue
Block a user