@cosmos.gl/graph 2.1.0 → 2.2.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/dist/index.d.ts +28 -0
- package/dist/index.js +2813 -2653
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +102 -40
- package/dist/index.min.js.map +1 -1
- package/dist/modules/Points/index.d.ts +6 -0
- package/dist/stories/clusters/polygon-selection/index.d.ts +6 -0
- package/dist/stories/clusters/polygon-selection/polygon.d.ts +20 -0
- package/dist/stories/clusters.stories.d.ts +1 -0
- package/package.json +1 -1
- package/src/index.ts +79 -2
- package/src/modules/Points/find-points-on-polygon-selection.frag +65 -0
- package/src/modules/Points/index.ts +69 -0
- package/src/stories/3. api-reference.mdx +39 -2
- package/src/stories/beginners/basic-set-up/index.ts +1 -1
- package/src/stories/clusters/polygon-selection/index.ts +53 -0
- package/src/stories/clusters/polygon-selection/polygon.ts +143 -0
- package/src/stories/clusters/polygon-selection/style.css +8 -0
- package/src/stories/clusters.stories.ts +16 -0
package/dist/index.d.ts
CHANGED
|
@@ -238,12 +238,40 @@ export declare class Graph {
|
|
|
238
238
|
* The `top` and `bottom` coordinates should be from 0 to the height of the canvas.
|
|
239
239
|
* @returns A Float32Array containing the indices of points inside a rectangular area.
|
|
240
240
|
*/
|
|
241
|
+
getPointsInRect(selection: [[number, number], [number, number]]): Float32Array;
|
|
242
|
+
/**
|
|
243
|
+
* Get points indices inside a rectangular area.
|
|
244
|
+
* @param selection - Array of two corner points `[[left, top], [right, bottom]]`.
|
|
245
|
+
* The `left` and `right` coordinates should be from 0 to the width of the canvas.
|
|
246
|
+
* The `top` and `bottom` coordinates should be from 0 to the height of the canvas.
|
|
247
|
+
* @returns A Float32Array containing the indices of points inside a rectangular area.
|
|
248
|
+
* @deprecated Use `getPointsInRect` instead. This method will be removed in a future version.
|
|
249
|
+
*/
|
|
241
250
|
getPointsInRange(selection: [[number, number], [number, number]]): Float32Array;
|
|
251
|
+
/**
|
|
252
|
+
* Get points indices inside a polygon area.
|
|
253
|
+
* @param polygonPath - Array of points `[[x1, y1], [x2, y2], ..., [xn, yn]]` that defines the polygon.
|
|
254
|
+
* The coordinates should be from 0 to the width/height of the canvas.
|
|
255
|
+
* @returns A Float32Array containing the indices of points inside the polygon area.
|
|
256
|
+
*/
|
|
257
|
+
getPointsInPolygon(polygonPath: [number, number][]): Float32Array;
|
|
242
258
|
/** Select points inside a rectangular area.
|
|
243
259
|
* @param selection - Array of two corner points `[[left, top], [right, bottom]]`.
|
|
244
260
|
* The `left` and `right` coordinates should be from 0 to the width of the canvas.
|
|
245
261
|
* The `top` and `bottom` coordinates should be from 0 to the height of the canvas. */
|
|
262
|
+
selectPointsInRect(selection: [[number, number], [number, number]] | null): void;
|
|
263
|
+
/** Select points inside a rectangular area.
|
|
264
|
+
* @param selection - Array of two corner points `[[left, top], [right, bottom]]`.
|
|
265
|
+
* The `left` and `right` coordinates should be from 0 to the width of the canvas.
|
|
266
|
+
* The `top` and `bottom` coordinates should be from 0 to the height of the canvas.
|
|
267
|
+
* @deprecated Use `selectPointsInRect` instead. This method will be removed in a future version.
|
|
268
|
+
*/
|
|
246
269
|
selectPointsInRange(selection: [[number, number], [number, number]] | null): void;
|
|
270
|
+
/** Select points inside a polygon area.
|
|
271
|
+
* @param polygonPath - Array of points `[[x1, y1], [x2, y2], ..., [xn, yn]]` that defines the polygon.
|
|
272
|
+
* The coordinates should be from 0 to the width/height of the canvas.
|
|
273
|
+
* Set to null to clear selection. */
|
|
274
|
+
selectPointsInPolygon(polygonPath: [number, number][] | null): void;
|
|
247
275
|
/**
|
|
248
276
|
* Select a point by index. If you want the adjacent points to get selected too, provide `true` as the second argument.
|
|
249
277
|
* @param index The index of the point in the array of points.
|