Do not ascend when node has more siblings
This commit is contained in:
+13
-5
@@ -609,8 +609,9 @@ ol.structs.RBush.prototype.remove_ = function(extent, value) {
|
|||||||
var path = [node];
|
var path = [node];
|
||||||
/** @type {Array.<number>} */
|
/** @type {Array.<number>} */
|
||||||
var indexes = [0];
|
var indexes = [0];
|
||||||
var child, children, i, ii;
|
var childrenDone, child, children, i, ii;
|
||||||
while (path.length > 0) {
|
while (path.length > 0) {
|
||||||
|
childrenDone = false;
|
||||||
goog.asserts.assert(node.height > 0);
|
goog.asserts.assert(node.height > 0);
|
||||||
if (node.height == 1) {
|
if (node.height == 1) {
|
||||||
children = node.children;
|
children = node.children;
|
||||||
@@ -622,8 +623,7 @@ ol.structs.RBush.prototype.remove_ = function(extent, value) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
node = path.pop();
|
childrenDone = true;
|
||||||
index = indexes.pop();
|
|
||||||
} else if (index < node.children.length) {
|
} else if (index < node.children.length) {
|
||||||
child = node.children[index];
|
child = node.children[index];
|
||||||
if (ol.extent.containsExtent(child.extent, extent)) {
|
if (ol.extent.containsExtent(child.extent, extent)) {
|
||||||
@@ -635,8 +635,16 @@ ol.structs.RBush.prototype.remove_ = function(extent, value) {
|
|||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
node = path.pop();
|
childrenDone = true;
|
||||||
index = indexes.pop();
|
}
|
||||||
|
if (childrenDone === true) {
|
||||||
|
var lastPathIndex = path.length - 1;
|
||||||
|
node = path[lastPathIndex];
|
||||||
|
index = ++indexes[lastPathIndex];
|
||||||
|
if (index > node.children.length) {
|
||||||
|
path.pop();
|
||||||
|
indexes.pop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user