copper3d 3.6.9 → 3.6.10
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/Utils/surfaceAnnotation/SurfaceAnnotator.d.ts +41 -19
- package/dist/Utils/surfaceAnnotation/SurfaceAnnotator.js +329 -115
- package/dist/Utils/surfaceAnnotation/SurfaceAnnotator.js.map +1 -1
- package/dist/Utils/surfaceAnnotation/annotationStore.d.ts +3 -10
- package/dist/Utils/surfaceAnnotation/annotationStore.js +21 -10
- package/dist/Utils/surfaceAnnotation/annotationStore.js.map +1 -1
- package/dist/Utils/surfaceAnnotation/geodesicContour.d.ts +26 -0
- package/dist/Utils/surfaceAnnotation/geodesicContour.js +101 -1
- package/dist/Utils/surfaceAnnotation/geodesicContour.js.map +1 -1
- package/dist/Utils/surfaceAnnotation/pointMarkers.d.ts +8 -0
- package/dist/Utils/surfaceAnnotation/pointMarkers.js +19 -0
- package/dist/Utils/surfaceAnnotation/pointMarkers.js.map +1 -1
- package/dist/Utils/surfaceAnnotation/types.d.ts +6 -0
- package/dist/Utils/surfaceAnnotation/types.js.map +1 -1
- package/dist/bundle.esm.js +471 -128
- package/dist/bundle.umd.js +471 -128
- package/dist/types/Utils/surfaceAnnotation/SurfaceAnnotator.d.ts +41 -19
- package/dist/types/Utils/surfaceAnnotation/annotationStore.d.ts +3 -10
- package/dist/types/Utils/surfaceAnnotation/geodesicContour.d.ts +26 -0
- package/dist/types/Utils/surfaceAnnotation/pointMarkers.d.ts +8 -0
- package/dist/types/Utils/surfaceAnnotation/types.d.ts +6 -0
- package/package.json +1 -1
|
@@ -31,11 +31,15 @@ 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
|
|
34
|
+
/** Callback when the engine changes the selection itself (delete, deselect-on-navigate) so the UI can mirror it. */
|
|
35
|
+
onSelectionChange?: (id: string | null) => void;
|
|
36
|
+
/** Callback when interaction state changes (drawing, armed tool, draw-lock status, geodesic-editing). */
|
|
35
37
|
onInteractionChange?: (s: {
|
|
36
38
|
drawing: boolean;
|
|
37
39
|
armed: AnnotationMode;
|
|
38
40
|
locked: boolean;
|
|
41
|
+
/** True while a geodesic is editable (in-progress or a re-opened committed one) → its anchors can be dragged/deleted/inserted. */
|
|
42
|
+
editing: boolean;
|
|
39
43
|
}) => void;
|
|
40
44
|
}
|
|
41
45
|
/**
|
|
@@ -71,10 +75,15 @@ export declare class SurfaceAnnotator {
|
|
|
71
75
|
private activeGeoMarkers;
|
|
72
76
|
private geoRay;
|
|
73
77
|
private geoNdc;
|
|
74
|
-
private geoHoverBadge?;
|
|
75
78
|
private hoveredGeoMarker;
|
|
79
|
+
private draggingAnchor;
|
|
80
|
+
private geoRedrawScheduled;
|
|
81
|
+
private editingId;
|
|
82
|
+
private geoClosed;
|
|
76
83
|
private _projV;
|
|
77
84
|
constructor(opts: SurfaceAnnotatorOptions);
|
|
85
|
+
/** Block the OS right-click menu when the pointer is over the WebGL canvas (not the HTML panels). */
|
|
86
|
+
private onContextMenu;
|
|
78
87
|
/** Update the pixel resolution of all fat lines on window resize, otherwise line width distorts. */
|
|
79
88
|
private onResize;
|
|
80
89
|
private get freehandColor();
|
|
@@ -89,22 +98,15 @@ export declare class SurfaceAnnotator {
|
|
|
89
98
|
clearAll(): void;
|
|
90
99
|
deleteAnnotation(id: string): void;
|
|
91
100
|
selectAnnotation(id: string | null): void;
|
|
101
|
+
/** Change the selection from inside the engine (delete / deselect-on-navigate) and mirror it to the UI. */
|
|
102
|
+
private setSelected;
|
|
92
103
|
/** Redraw the corresponding three object after a color change. */
|
|
93
104
|
refreshAnnotation(id: string): void;
|
|
94
105
|
exportJSON(modelName: string, opts?: ExportOptions): {
|
|
95
106
|
model: string;
|
|
96
107
|
exportedAt: string;
|
|
97
108
|
space: "local" | "world";
|
|
98
|
-
annotations:
|
|
99
|
-
id: string;
|
|
100
|
-
type: "contour" | "points";
|
|
101
|
-
mode: "freehand" | "geodesic" | null;
|
|
102
|
-
label: string;
|
|
103
|
-
color: string;
|
|
104
|
-
closed: boolean;
|
|
105
|
-
visible: boolean;
|
|
106
|
-
points: number[][];
|
|
107
|
-
}[];
|
|
109
|
+
annotations: Record<string, unknown>[];
|
|
108
110
|
};
|
|
109
111
|
setVisible(id: string, visible: boolean): void;
|
|
110
112
|
/**
|
|
@@ -122,15 +124,20 @@ export declare class SurfaceAnnotator {
|
|
|
122
124
|
closed: boolean;
|
|
123
125
|
visible?: boolean;
|
|
124
126
|
points: number[][];
|
|
127
|
+
anchors?: number[][];
|
|
125
128
|
}>;
|
|
126
129
|
}): number;
|
|
127
130
|
private get drawing();
|
|
128
131
|
private applyCameraGating;
|
|
132
|
+
/** Emit the current interaction state (camera gating + whether a geodesic is editable). */
|
|
133
|
+
private emitInteraction;
|
|
129
134
|
/** Reconcile the scene against store.list(): add missing objects, remove deleted ones (no dispose, kept for undo restore). */
|
|
130
135
|
private reconcile;
|
|
131
136
|
private applySelection;
|
|
132
137
|
private disposeObject;
|
|
133
138
|
private nextId;
|
|
139
|
+
/** Parse a raw exported point ([x,y,z] or [x,y,z,nx,ny,nz], local space) into an AnnotationVertex, recovering the normal from the nearest graph vertex when absent. */
|
|
140
|
+
private rawToVertex;
|
|
134
141
|
private hit;
|
|
135
142
|
/**
|
|
136
143
|
* Whether the event target is the WebGL canvas inside the container.
|
|
@@ -141,6 +148,10 @@ export declare class SurfaceAnnotator {
|
|
|
141
148
|
*/
|
|
142
149
|
private insideContainer;
|
|
143
150
|
private onPointerDown;
|
|
151
|
+
/** After any anchor edit: refresh markers + line; drop/delete the contour when it becomes degenerate. */
|
|
152
|
+
private afterGeoEdit;
|
|
153
|
+
/** Coalesce live drag redraws to one per animation frame (moveAnchorTo runs Dijkstra per move). */
|
|
154
|
+
private scheduleGeoRedraw;
|
|
144
155
|
/**
|
|
145
156
|
* Pick an in-progress anchor: return the index of the nearest anchor (screen pixel distance <
|
|
146
157
|
* tolerance), or -1 on a miss.
|
|
@@ -154,15 +165,14 @@ export declare class SurfaceAnnotator {
|
|
|
154
165
|
* radius to make it easy to hit.
|
|
155
166
|
*/
|
|
156
167
|
private pickGeoMarker;
|
|
157
|
-
/**
|
|
168
|
+
/**
|
|
169
|
+
* Set the currently hovered anchor (-1 = none): scale it up as a highlight and show a "grab"
|
|
170
|
+
* cursor to signal it's draggable. Delete is now a right-click (no floating ✕ affordance).
|
|
171
|
+
*/
|
|
158
172
|
private setGeoHover;
|
|
159
|
-
/**
|
|
160
|
-
private ensureGeoBadge;
|
|
161
|
-
/** Position the ✕ badge at the anchor's screen projection (dead center, i.e. where the cursor hovers, to avoid ambiguity). */
|
|
162
|
-
private positionGeoBadge;
|
|
163
|
-
/** Rebuild the visible anchor spheres from the current anchors (slightly larger than placed points, so they're easy to see and click to cancel). */
|
|
173
|
+
/** Rebuild the visible anchor spheres from the current anchors (slightly larger than placed points, so they're easy to see and grab). */
|
|
164
174
|
private rebuildGeoMarkers;
|
|
165
|
-
/** Redraw the
|
|
175
|
+
/** Redraw the active geodesic from its current anchors (honoring the closed state); when editing a committed contour, also keep the stored annotation data in sync so export stays correct. */
|
|
166
176
|
private redrawGeoLine;
|
|
167
177
|
/** Discard the in-progress geodesic: remove and dispose the line and all anchors. */
|
|
168
178
|
private clearActiveGeo;
|
|
@@ -175,6 +185,18 @@ export declare class SurfaceAnnotator {
|
|
|
175
185
|
private surfacePathBetween;
|
|
176
186
|
/** Finish the current geodesic: close it into a ring and commit it as one contour. */
|
|
177
187
|
private finishGeodesic;
|
|
188
|
+
/**
|
|
189
|
+
* Re-open a committed geodesic contour for editing: rebuild its anchors (from the stored positions)
|
|
190
|
+
* as draggable markers and reuse its line for live updates. No-op for non-geodesic / anchorless
|
|
191
|
+
* annotations. The edit session ends on Enter / mode-switch / selecting another / Esc.
|
|
192
|
+
*/
|
|
193
|
+
private tryOpenGeoEdit;
|
|
194
|
+
/**
|
|
195
|
+
* Finalize an edit session on a committed geodesic: the annotation data was kept in sync live
|
|
196
|
+
* (redrawGeoLine), so here we just remove the edit markers, notify subscribers, and end the
|
|
197
|
+
* session — or delete the annotation if it was reduced below 2 anchors.
|
|
198
|
+
*/
|
|
199
|
+
private recommitGeodesic;
|
|
178
200
|
private isTypingTarget;
|
|
179
201
|
private onKeyDown;
|
|
180
202
|
private onKeyUp;
|