@loradb/lora-graph-canvas 0.11.0 → 0.11.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/types.d.ts CHANGED
@@ -200,6 +200,12 @@ export interface LoraGraphCanvasProps<N extends NodeObject = NodeObject, L exten
200
200
  * and pins them as a group on release. Set to `false` to keep the
201
201
  * default simulation-pull behaviour. */
202
202
  fixOnDrop?: boolean;
203
+ /** When `true` (default `false`), the camera animates to fit the
204
+ * current selection any time it changes — like the toolbar "fit"
205
+ * button, but scoped to the selected nodes (and the endpoints of
206
+ * any selected links). No-ops when the selection becomes empty;
207
+ * the user keeps their view instead of being snapped back. */
208
+ fitOnSelect?: boolean;
203
209
  /** Auto-tune renderer / simulation settings based on graph size so
204
210
  * the canvas stays responsive into the 50k-100k-node range.
205
211
  *
@@ -367,6 +373,27 @@ export interface LoraGraphCanvasHandle<N extends NodeObject = NodeObject, L exte
367
373
  zoom(scale: number, durationMs?: number): void;
368
374
  zoomIn(step?: number): void;
369
375
  zoomOut(step?: number): void;
376
+ /** Translate the view by a world-space delta. In 2D the z component
377
+ * is ignored (the camera height is locked). */
378
+ panBy(delta: {
379
+ x?: number;
380
+ y?: number;
381
+ z?: number;
382
+ }, durationMs?: number): void;
383
+ /** Animate to a world coordinate, preserving the current viewing
384
+ * direction. Use for "jump to coordinates" UI. */
385
+ goTo(target: {
386
+ x: number;
387
+ y: number;
388
+ z?: number;
389
+ }, opts?: {
390
+ durationMs?: number;
391
+ }): void;
392
+ /** Fit the view to a subset of nodes. Empty array → full fit. */
393
+ fitToNodes(nodeIds: ReadonlyArray<string | number>, durationMs?: number, padding?: number): void;
394
+ /** Fit to the current selection (nodes + endpoints of selected links).
395
+ * No-op if nothing is selected. */
396
+ fitToSelection(durationMs?: number, padding?: number): void;
370
397
  copy(): N[];
371
398
  /** Cut funnels through the same delete-gate as keyboard / toolbar
372
399
  * cuts. A rejected guard resolves to an empty array and leaves the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loradb/lora-graph-canvas",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "React graph canvas for LoraDB. Unified 2D/3D force-directed component with a built-in tool palette for adding, connecting, selecting, and removing nodes.",
5
5
  "license": "BUSL-1.1",
6
6
  "packageManager": "yarn@4.5.1",
@@ -57,6 +57,7 @@
57
57
  "test": "vitest run",
58
58
  "test:watch": "vitest",
59
59
  "lint": "eslint src test",
60
+ "lint:fix": "eslint src test --fix",
60
61
  "format": "prettier --write src test",
61
62
  "format:check": "prettier --check src test",
62
63
  "storybook": "storybook dev -p 6007",