mirror of
https://github.com/mourner/flatbush.git
synced 2026-02-01 14:34:08 +00:00
fix index.neighbors freezing with just x/y args
This commit is contained in:
parent
41481c5c5e
commit
f3d24b3ba3
2
index.js
2
index.js
@ -247,7 +247,7 @@ export default class Flatbush {
|
||||
}
|
||||
}
|
||||
|
||||
nodeIndex = q.pop() >> 1;
|
||||
nodeIndex = q.length ? q.pop() >> 1 : undefined;
|
||||
}
|
||||
|
||||
q.clear();
|
||||
|
||||
6
test.js
6
test.js
@ -155,6 +155,12 @@ test('k-nearest-neighbors query accepts filterFn', () => {
|
||||
assert.deepEqual(ids.sort(compare), [6, 16, 18, 24, 54, 80].sort(compare));
|
||||
});
|
||||
|
||||
test('performs a k-nearest-neighbors query with all items', () => {
|
||||
const index = createIndex();
|
||||
const ids = index.neighbors(50, 50);
|
||||
assert.deepEqual(ids.length, data.length >> 2);
|
||||
});
|
||||
|
||||
test('returns index of newly-added rectangle', () => {
|
||||
const count = 5;
|
||||
const index = new Flatbush(count);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user