@gridworkjs/kd 1.0.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -85,6 +85,10 @@ Number of items in the tree.
85
85
 
86
86
  Bounding box of all items, or `null` if empty.
87
87
 
88
+ ### `tree.accessor`
89
+
90
+ The bounds accessor function passed at construction.
91
+
88
92
  ## License
89
93
 
90
94
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridworkjs/kd",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "KD-tree spatial index for static point sets and nearest-neighbor queries",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/kd.js CHANGED
@@ -256,6 +256,8 @@ export function createKdTree(accessor) {
256
256
  const index = {
257
257
  [SPATIAL_INDEX]: true,
258
258
 
259
+ accessor,
260
+
259
261
  get size() { return size },
260
262
 
261
263
  get bounds() { return totalBounds },
package/types/kd.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * @param {(item: any) => Bounds | object} accessor - Maps items to their bounding boxes or geometries
6
6
  * @returns {import('@gridworkjs/core').SpatialIndex & { load: (items: any[]) => void }}
7
7
  */
8
- export function createKdTree(accessor: (item: any) => Bounds | object): any & {
8
+ export function createKdTree(accessor: (item: any) => Bounds | object): import("@gridworkjs/core").SpatialIndex & {
9
9
  load: (items: any[]) => void;
10
10
  };
11
11
  export type Bounds<T> = {