Handle projection being undefined in getView2DState

This commit is contained in:
Tom Payne
2013-06-25 12:26:35 +02:00
parent f462adbe53
commit fab12b10c1

View File

@@ -305,12 +305,12 @@ ol.View2D.prototype.getView2D = function() {
ol.View2D.prototype.getView2DState = function() {
goog.asserts.assert(this.isDef());
var center = /** @type {ol.Coordinate} */ (this.getCenter());
var projection = /** @type {ol.Projection} */ (this.getProjection());
var projection = this.getProjection();
var resolution = /** @type {number} */ (this.getResolution());
var rotation = this.getRotation();
return {
center: center.slice(),
projection: projection,
projection: goog.isDef(projection) ? projection : null,
resolution: resolution,
rotation: goog.isDef(rotation) ? rotation : 0
};