From 554e17ac22b67ab0458b23e7fbb3cac56c21cb35 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Sat, 7 Dec 2013 19:51:54 +0100 Subject: [PATCH] Set geometry to null if no geometry given --- src/ol/feature.js | 4 +++- src/ol/geom/geometry.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ol/feature.js b/src/ol/feature.js index 3d6066da29..e4200c70d4 100644 --- a/src/ol/feature.js +++ b/src/ol/feature.js @@ -48,7 +48,7 @@ ol.Feature = function(opt_geometryOrValues) { this, ol.Object.getChangeEventType(ol.FeatureProperty.GEOMETRY), this.handleGeometryChanged_, false, this); - if (goog.isDef(opt_geometryOrValues)) { + if (goog.isDefAndNotNull(opt_geometryOrValues)) { if (opt_geometryOrValues instanceof ol.geom.Geometry) { var geometry = /** @type {ol.geom.Geometry} */ (opt_geometryOrValues); this.setGeometry(geometry); @@ -57,6 +57,8 @@ ol.Feature = function(opt_geometryOrValues) { var values = /** @type {Object.} */ (opt_geometryOrValues); this.setValues(values); } + } else { + this.setGeometry(null); } }; goog.inherits(ol.Feature, ol.Object); diff --git a/src/ol/geom/geometry.js b/src/ol/geom/geometry.js index 508981b0f8..a1a8f7e6d1 100644 --- a/src/ol/geom/geometry.js +++ b/src/ol/geom/geometry.js @@ -251,8 +251,8 @@ ol.geom.Geometry.prototype.setLayout = ol.geom.Geometry.prototype.transform = function(transformFn) { if (!goog.isNull(this.flatCoordinates)) { transformFn(this.flatCoordinates, this.flatCoordinates, this.stride); + this.dispatchChangeEvent(); } - this.dispatchChangeEvent(); };