From 6343c0420d9f961aa5c6ad2b14a534605fcfe015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=20Peru=C4=8Di=C4=87?= Date: Mon, 30 Mar 2015 15:06:09 +0200 Subject: [PATCH] fix: prevent indexed extent from beeing overwitten when using ol.source.Vector with snap, indexedFeaturesExtents_ is updated whenever source calls geometry#getExtent --- src/ol/interaction/snapinteraction.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ol/interaction/snapinteraction.js b/src/ol/interaction/snapinteraction.js index 2c3b097995..9eca618070 100644 --- a/src/ol/interaction/snapinteraction.js +++ b/src/ol/interaction/snapinteraction.js @@ -27,8 +27,8 @@ goog.require('ol.structs.RBush'); /** * @classdesc * Handles snapping of vector features while modifying or drawing them. The - * features can come from a {@link ol.source.Vector}, a {@link ol.Collection} - * or a plain array. Any interaction object that allows the user to interact + * features can come from a {@link ol.source.Vector} or {@link ol.Collection} + * Any interaction object that allows the user to interact * with the features using the mouse can benefit from the snapping, as long * as it is added before. * @@ -163,7 +163,8 @@ ol.interaction.Snap.prototype.addFeature = function(feature, opt_listen) { var segmentWriter = this.SEGMENT_WRITERS_[geometry.getType()]; if (goog.isDef(segmentWriter)) { var feature_uid = goog.getUid(feature); - this.indexedFeaturesExtents_[feature_uid] = geometry.getExtent(); + this.indexedFeaturesExtents_[feature_uid] = geometry.getExtent( + ol.extent.createEmpty()); segmentWriter.call(this, feature, geometry); if (listen) {