Clone extents in ol.structs.RBush to prevent modification

This commit is contained in:
Tom Payne
2013-11-26 12:15:40 +01:00
committed by Tim Schaub
parent 880f098f0f
commit 92469901f7

View File

@@ -495,7 +495,7 @@ ol.structs.RBush.prototype.insert = function(extent, value) {
var key = this.getKey_(value); var key = this.getKey_(value);
goog.asserts.assert(!this.valueExtent_.hasOwnProperty(key)); goog.asserts.assert(!this.valueExtent_.hasOwnProperty(key));
this.insert_(extent, value, this.root_.height - 1); this.insert_(extent, value, this.root_.height - 1);
this.valueExtent_[key] = extent; this.valueExtent_[key] = ol.extent.clone(extent);
}; };
@@ -631,6 +631,6 @@ ol.structs.RBush.prototype.update = function(extent, value) {
if (!ol.extent.equals(currentExtent, extent)) { if (!ol.extent.equals(currentExtent, extent)) {
this.remove_(currentExtent, value); this.remove_(currentExtent, value);
this.insert_(extent, value, this.root_.height - 1); this.insert_(extent, value, this.root_.height - 1);
this.valueExtent_[key] = extent; ol.extent.clone(extent, currentExtent);
} }
}; };