copper3d 3.6.6 → 3.6.7

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.
@@ -31,6 +31,12 @@ export interface SurfaceAnnotatorOptions {
31
31
  onModeChange?: (m: AnnotationMode) => void;
32
32
  /** Callback when the annotation list changes (add/remove/undo/clear). */
33
33
  onChange?: (annotations: Annotation[]) => void;
34
+ /** Callback when interaction state changes (drawing, armed tool, draw-lock status). */
35
+ onInteractionChange?: (s: {
36
+ drawing: boolean;
37
+ armed: AnnotationMode;
38
+ locked: boolean;
39
+ }) => void;
34
40
  }
35
41
  /**
36
42
  * Main surface-annotation controller (Phase 4): four modes navigate / freehand / geodesic / point,
@@ -42,6 +48,11 @@ export declare class SurfaceAnnotator {
42
48
  private o;
43
49
  private mode;
44
50
  private spaceHeld;
51
+ private drawLock;
52
+ private armed;
53
+ private spaceDownAt;
54
+ private spaceDragged;
55
+ private static readonly TAP_MS;
45
56
  private pointerDown;
46
57
  private readonly markerRadius;
47
58
  private readonly epsilon;
@@ -91,9 +102,29 @@ export declare class SurfaceAnnotator {
91
102
  label: string;
92
103
  color: string;
93
104
  closed: boolean;
105
+ visible: boolean;
94
106
  points: number[][];
95
107
  }[];
96
108
  };
109
+ setVisible(id: string, visible: boolean): void;
110
+ /**
111
+ * Rebuild annotations from an exported payload (local-space points). Normals are taken from the
112
+ * point when present ([x,y,z,nx,ny,nz]); otherwise recovered from the welded graph's nearest
113
+ * vertex. Each imported item becomes first-class (select/recolor/hide/delete/export).
114
+ */
115
+ importAnnotations(payload: {
116
+ annotations: Array<{
117
+ id?: string;
118
+ type: "contour" | "points";
119
+ mode: "freehand" | "geodesic" | null;
120
+ label: string;
121
+ color: string;
122
+ closed: boolean;
123
+ visible?: boolean;
124
+ points: number[][];
125
+ }>;
126
+ }): number;
127
+ private get drawing();
97
128
  private applyCameraGating;
98
129
  /** Reconcile the scene against store.list(): add missing objects, remove deleted ones (no dispose, kept for undo restore). */
99
130
  private reconcile;
@@ -20,6 +20,7 @@ export declare class AnnotationStore {
20
20
  get(id: string): Annotation | undefined;
21
21
  setLabel(id: string, label: string): void;
22
22
  setColor(id: string, color: string): void;
23
+ setVisible(id: string, visible: boolean): void;
23
24
  toJSON(modelName: string, mesh: THREE.Mesh, opts?: ExportOptions): {
24
25
  model: string;
25
26
  exportedAt: string;
@@ -31,6 +32,7 @@ export declare class AnnotationStore {
31
32
  label: string;
32
33
  color: string;
33
34
  closed: boolean;
35
+ visible: boolean;
34
36
  points: number[][];
35
37
  }[];
36
38
  };
@@ -22,6 +22,7 @@ export interface Annotation {
22
22
  label: string;
23
23
  color: string;
24
24
  closed: boolean;
25
+ visible: boolean;
25
26
  vertices: AnnotationVertex[];
26
27
  object3D: THREE.Object3D | null;
27
28
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "copper3d",
3
3
  "description": "A 3d visualisation package base on threejs provides multiple scenes and Nrrd image load funtion.",
4
- "version": "3.6.6",
4
+ "version": "3.6.7",
5
5
  "main": "dist/bundle.umd.js",
6
6
  "moudle": "dist/bundle.esm.js",
7
7
  "types": "dist/types/index.d.ts",