Center tranformation in the api; moveByPx implemented.

This commit is contained in:
ahocevar
2012-06-22 20:49:58 +02:00
parent 5fa42e9b30
commit a6069bb78e
2 changed files with 22 additions and 13 deletions

View File

@@ -113,10 +113,17 @@ ol.map = function(opt_arg) {
*/
ol.Map.prototype.center = function(opt_arg) {
if (arguments.length == 1 && goog.isDef(opt_arg)) {
this.setCenter(ol.loc(opt_arg));
var loc = ol.loc(opt_arg);
var proj = loc.getProjection();
if (goog.isNull(proj)) {
proj = this.getUserProjection();
loc.setProjection(proj);
}
this.setCenter(loc);
return this;
} else {
return this.getCenter();
var proj = this.getUserProjection();
return this.getCenter().doTransform(proj);
}
};