three-cad-viewer 5.0.7 → 5.1.0

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.
@@ -280,6 +280,11 @@ declare class Display {
280
280
  * @internal
281
281
  */
282
282
  setupUI(viewer: Viewer, canvasElement: HTMLCanvasElement): void;
283
+ /**
284
+ * Ctrl/Cmd-C while the cursor is over the canvas copies the point under it.
285
+ * Text-entry fields and selected text keep the normal copy.
286
+ */
287
+ private _handleCopyPoint;
283
288
  /**
284
289
  * Subscribe to ViewerState changes to keep UI in sync.
285
290
  * Stores unsubscribe functions for cleanup in dispose().
@@ -8,6 +8,7 @@ type ObjectHandler = (path: string, state: StateValue, iconNumber: number, propa
8
8
  type PickHandler = (parentPath: string, name: string, meta: boolean, shift: boolean, alt: boolean, extra: THREE.Vector3 | null, nodeType: "leaf" | "node" | string | null, fromTree: boolean) => void;
9
9
  type UpdateHandler = (flag: boolean) => void;
10
10
  type NotificationHandler = () => void;
11
+ type HoverHandler = (path: string | null) => void;
11
12
  type ColorGetter = (path: string) => string | null;
12
13
  /**
13
14
  * A tree viewer component with lazy loading of large trees.
@@ -24,6 +25,7 @@ declare class TreeView {
24
25
  theme: string;
25
26
  linkIcons: boolean;
26
27
  debug: boolean;
28
+ hoverHandler: HoverHandler | null;
27
29
  model: TreeModel | null;
28
30
  container: HTMLUListElement | null;
29
31
  lastLabel: HTMLElement | null;
@@ -40,8 +42,9 @@ declare class TreeView {
40
42
  * @param theme - The UI theme ('light' or 'dark').
41
43
  * @param linkIcons - Whether icon 0 and 1 are linked.
42
44
  * @param debug - Enable debug logging.
45
+ * @param hoverHandler - Callback for label hover (node path, or null on leave).
43
46
  */
44
- constructor(tree: TreeData, scrollContainer: HTMLElement, objectHandler: ObjectHandler, pickHandler: PickHandler, updateHandler: UpdateHandler, notificationHandler: NotificationHandler, colorGetter: ColorGetter, theme: string, linkIcons: boolean, debug?: boolean);
47
+ constructor(tree: TreeData, scrollContainer: HTMLElement, objectHandler: ObjectHandler, pickHandler: PickHandler, updateHandler: UpdateHandler, notificationHandler: NotificationHandler, colorGetter: ColorGetter, theme: string, linkIcons: boolean, debug?: boolean, hoverHandler?: HoverHandler | null);
45
48
  /**
46
49
  * Initialize the tree view - creates the model and DOM container.
47
50
  * @returns The container element.
@@ -142,5 +142,18 @@ declare class EventListenerManager {
142
142
  add: (target: EventTarget, event: string, handler: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void;
143
143
  dispose(): void;
144
144
  }
145
- export { flatten, isEqual, sceneTraverse, prettyPrintVector, KeyMapper, scaleLight, deepDispose, disposeGeometry, EventListenerManager, isMesh, isLine, isPoints, isOrthographicCamera, isPerspectiveCamera, isLineSegments2, hasColor, hasEmissive, isMeshStandardMaterial, toVector3Tuple, toQuaternionTuple, };
145
+ /**
146
+ * Copy `text` to the clipboard from inside a user-initiated event handler.
147
+ *
148
+ * Tries the synchronous hidden-textarea `execCommand("copy")` first: it needs no
149
+ * clipboard permission, so it also works in embedding iframes and WebKit views that
150
+ * refuse `navigator.clipboard`. Falls back to the async Clipboard API.
151
+ * Focus is restored to the previously focused element.
152
+ *
153
+ * @param text - The text to copy.
154
+ * @param parent - Element the temporary textarea is attached to.
155
+ * @returns true when the synchronous copy reported success.
156
+ */
157
+ declare function copyText(text: string, parent: HTMLElement): boolean;
158
+ export { copyText, flatten, isEqual, sceneTraverse, prettyPrintVector, KeyMapper, scaleLight, deepDispose, disposeGeometry, EventListenerManager, isMesh, isLine, isPoints, isOrthographicCamera, isPerspectiveCamera, isLineSegments2, hasColor, hasEmissive, isMeshStandardMaterial, toVector3Tuple, toQuaternionTuple, };
146
159
  export type { KeyEventKey, KeyMappingConfig, DisposableTree };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "three-cad-viewer",
3
- "version": "5.0.7",
3
+ "version": "5.1.0",
4
4
  "type": "module",
5
5
  "description": "WebGL-based CAD viewer built on Three.js with clipping planes, measurement tools, and tree navigation",
6
6
  "repository": {