Skip to content

Commit 8f728af

Browse files
committed
move FlatQueue init to finish()
1 parent 4293e90 commit 8f728af

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ export default class Flatbush {
8484
new Uint16Array(this.data, 2, 1)[0] = nodeSize;
8585
new Uint32Array(this.data, 4, 1)[0] = numItems;
8686
}
87-
88-
// a priority queue for k-nearest-neighbors queries
89-
this._queue = new FlatQueue();
9087
}
9188

9289
add(minX, minY, maxX, maxY) {
@@ -131,6 +128,9 @@ export default class Flatbush {
131128
throw new Error(`Added ${this._pos >> 2} items when expected ${this.numItems}.`);
132129
}
133130

131+
// a priority queue for k-nearest-neighbors queries
132+
this._queue = new FlatQueue();
133+
134134
if (this.numItems <= this.nodeSize) {
135135
// only one node, skip sorting and just fill the root box
136136
this._boxes[this._pos++] = this.minX;

0 commit comments

Comments
 (0)