three-cad-viewer 5.0.4 → 5.0.5
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/scene/objectgroup.d.ts +5 -4
- package/dist/three-cad-viewer.esm.js +34 -42
- package/dist/three-cad-viewer.esm.js.map +1 -1
- package/dist/three-cad-viewer.esm.min.js +3 -3
- package/dist/three-cad-viewer.js +34 -42
- package/dist/three-cad-viewer.min.js +2 -2
- package/dist/ui/display.d.ts +2 -10
- package/package.json +1 -1
|
@@ -87,6 +87,7 @@ declare class ObjectGroup extends THREE.Group {
|
|
|
87
87
|
private _cadOriginalBackColor;
|
|
88
88
|
private _isStudioMode;
|
|
89
89
|
private _cadEdgesVisible;
|
|
90
|
+
private _cadVerticesVisible;
|
|
90
91
|
/**
|
|
91
92
|
* Create an ObjectGroup for managing a CAD object's visual representation.
|
|
92
93
|
* @param opacity - Default opacity value (0.0 to 1.0).
|
|
@@ -308,12 +309,12 @@ declare class ObjectGroup extends THREE.Group {
|
|
|
308
309
|
*/
|
|
309
310
|
leaveStudioMode(): void;
|
|
310
311
|
/**
|
|
311
|
-
* Toggle edge visibility while in Studio mode.
|
|
312
|
+
* Toggle edge and vertex visibility while in Studio mode.
|
|
312
313
|
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
314
|
+
* Should only be called while in Studio mode; the saved CAD edge/vertex
|
|
315
|
+
* visibility is not affected and is restored by `leaveStudioMode()`.
|
|
315
316
|
*
|
|
316
|
-
* @param visible - Whether edges should be visible
|
|
317
|
+
* @param visible - Whether edges and vertices should be visible
|
|
317
318
|
*/
|
|
318
319
|
setStudioShowEdges(visible: boolean): void;
|
|
319
320
|
}
|
|
@@ -82235,6 +82235,7 @@ class ObjectGroup extends Group {
|
|
|
82235
82235
|
this._cadOriginalBackColor = null;
|
|
82236
82236
|
this._isStudioMode = false;
|
|
82237
82237
|
this._cadEdgesVisible = null;
|
|
82238
|
+
this._cadVerticesVisible = null;
|
|
82238
82239
|
}
|
|
82239
82240
|
/**
|
|
82240
82241
|
* Get the zebra tool, creating it on first access.
|
|
@@ -82276,6 +82277,7 @@ class ObjectGroup extends Group {
|
|
|
82276
82277
|
this._cadOriginalBackColor = null;
|
|
82277
82278
|
this._isStudioMode = false;
|
|
82278
82279
|
this._cadEdgesVisible = null;
|
|
82280
|
+
this._cadVerticesVisible = null;
|
|
82279
82281
|
}
|
|
82280
82282
|
/**
|
|
82281
82283
|
* Set the front face mesh.
|
|
@@ -82631,7 +82633,13 @@ class ObjectGroup extends Group {
|
|
|
82631
82633
|
}
|
|
82632
82634
|
}
|
|
82633
82635
|
if (this.vertices) {
|
|
82634
|
-
this.
|
|
82636
|
+
if (this._isStudioMode) {
|
|
82637
|
+
// Same rule as edges: Studio hides vertices, record the CAD intent only.
|
|
82638
|
+
this._cadVerticesVisible = flag;
|
|
82639
|
+
}
|
|
82640
|
+
else {
|
|
82641
|
+
this.vertices.material.visible = flag;
|
|
82642
|
+
}
|
|
82635
82643
|
}
|
|
82636
82644
|
this._syncPickVertices();
|
|
82637
82645
|
}
|
|
@@ -82840,10 +82848,14 @@ class ObjectGroup extends Group {
|
|
|
82840
82848
|
this._cadOriginalBackColor = this.originalBackColor
|
|
82841
82849
|
? this.originalBackColor.clone()
|
|
82842
82850
|
: null;
|
|
82843
|
-
// Save edge visibility state
|
|
82851
|
+
// Save edge and vertex visibility state (also for edge-only / vertex-only
|
|
82852
|
+
// groups, which have no front mesh and get no studio material)
|
|
82844
82853
|
this._cadEdgesVisible = this.edgeMaterial
|
|
82845
82854
|
? this.edgeMaterial.visible
|
|
82846
82855
|
: null;
|
|
82856
|
+
this._cadVerticesVisible = this.vertices
|
|
82857
|
+
? this.vertices.material.visible
|
|
82858
|
+
: null;
|
|
82847
82859
|
// --- Swap front material ---
|
|
82848
82860
|
if (this.front && studioFront) {
|
|
82849
82861
|
// Transfer per-object visibility to mesh.visible (NOT material.visible)
|
|
@@ -82897,24 +82909,30 @@ class ObjectGroup extends Group {
|
|
|
82897
82909
|
if (this._cadOriginalBackColor) {
|
|
82898
82910
|
this.originalBackColor = this._cadOriginalBackColor.clone();
|
|
82899
82911
|
}
|
|
82900
|
-
// --- Restore edge visibility ---
|
|
82912
|
+
// --- Restore edge and vertex visibility ---
|
|
82901
82913
|
if (this.edgeMaterial && this._cadEdgesVisible !== null) {
|
|
82902
82914
|
this.edgeMaterial.visible = this._cadEdgesVisible;
|
|
82903
82915
|
}
|
|
82916
|
+
if (this.vertices && this._cadVerticesVisible !== null) {
|
|
82917
|
+
this.vertices.material.visible = this._cadVerticesVisible;
|
|
82918
|
+
}
|
|
82904
82919
|
this._isStudioMode = false;
|
|
82905
82920
|
}
|
|
82906
82921
|
/**
|
|
82907
|
-
* Toggle edge visibility while in Studio mode.
|
|
82922
|
+
* Toggle edge and vertex visibility while in Studio mode.
|
|
82908
82923
|
*
|
|
82909
|
-
*
|
|
82910
|
-
*
|
|
82924
|
+
* Should only be called while in Studio mode; the saved CAD edge/vertex
|
|
82925
|
+
* visibility is not affected and is restored by `leaveStudioMode()`.
|
|
82911
82926
|
*
|
|
82912
|
-
* @param visible - Whether edges should be visible
|
|
82927
|
+
* @param visible - Whether edges and vertices should be visible
|
|
82913
82928
|
*/
|
|
82914
82929
|
setStudioShowEdges(visible) {
|
|
82915
82930
|
if (this.edgeMaterial) {
|
|
82916
82931
|
this.edgeMaterial.visible = visible;
|
|
82917
82932
|
}
|
|
82933
|
+
if (this.vertices) {
|
|
82934
|
+
this.vertices.material.visible = visible;
|
|
82935
|
+
}
|
|
82918
82936
|
}
|
|
82919
82937
|
}
|
|
82920
82938
|
/**
|
|
@@ -88252,13 +88270,17 @@ class NestedGroup {
|
|
|
88252
88270
|
}
|
|
88253
88271
|
// Track material tags that failed to resolve
|
|
88254
88272
|
const unresolvedTags = new Set();
|
|
88255
|
-
// Iterate all ObjectGroups with front meshes
|
|
88256
88273
|
for (const path in this.groups) {
|
|
88257
88274
|
const obj = this.groups[path];
|
|
88258
88275
|
if (!(obj instanceof ObjectGroup))
|
|
88259
88276
|
continue;
|
|
88260
|
-
if (!obj.front)
|
|
88277
|
+
if (!obj.front) {
|
|
88278
|
+
// Edge-only / vertex-only group: no studio material, but it must still
|
|
88279
|
+
// enter studio mode so its CAD edge/vertex visibility is saved and
|
|
88280
|
+
// restored on leave (setStudioShowEdges hides both in studio).
|
|
88281
|
+
obj.enterStudioMode(null, null);
|
|
88261
88282
|
continue;
|
|
88283
|
+
}
|
|
88262
88284
|
// Determine material tag, leaf color, and leaf alpha
|
|
88263
88285
|
const tag = obj.materialTag || "";
|
|
88264
88286
|
const leafColor = obj.originalColor
|
|
@@ -97328,7 +97350,7 @@ class Tools {
|
|
|
97328
97350
|
}
|
|
97329
97351
|
}
|
|
97330
97352
|
|
|
97331
|
-
const version = "5.0.
|
|
97353
|
+
const version = "5.0.5";
|
|
97332
97354
|
|
|
97333
97355
|
/**
|
|
97334
97356
|
* `PickedComponent` over a GPU id-pick result. Drives the shader
|
|
@@ -113365,6 +113387,8 @@ class Display {
|
|
|
113365
113387
|
/**
|
|
113366
113388
|
* Checkbox Handler for setting the tools mode.
|
|
113367
113389
|
* Delegates state mutations to Viewer.activateTool() to maintain unidirectional data flow.
|
|
113390
|
+
* The active tab is left untouched: a measure/select tool can run on any tab,
|
|
113391
|
+
* including Clip, so a sectioned model can be measured.
|
|
113368
113392
|
*/
|
|
113369
113393
|
this.setTool = (name, flag) => {
|
|
113370
113394
|
// Block tool activation while Studio mode is active
|
|
@@ -113372,15 +113396,9 @@ class Display {
|
|
|
113372
113396
|
return;
|
|
113373
113397
|
}
|
|
113374
113398
|
this.viewer.toggleAnimationLoop(flag);
|
|
113375
|
-
const activeTool = this.state.get("activeTool");
|
|
113376
|
-
const currentTool = typeof activeTool === "string" ? activeTool : "";
|
|
113377
113399
|
if (flag) {
|
|
113378
113400
|
// Delegate state mutations to Viewer
|
|
113379
113401
|
this.viewer.activateTool(name, true);
|
|
113380
|
-
if (["distance", "properties", "select"].includes(name) &&
|
|
113381
|
-
!["distance", "properties", "select"].includes(currentTool)) {
|
|
113382
|
-
this.viewer.toggleTab(true);
|
|
113383
|
-
}
|
|
113384
113402
|
this.viewer.setSelectionInput(flag);
|
|
113385
113403
|
if (name === "distance") {
|
|
113386
113404
|
this.viewer.cadTools.enable(ToolTypes.DISTANCE);
|
|
@@ -113396,9 +113414,6 @@ class Display {
|
|
|
113396
113414
|
}
|
|
113397
113415
|
}
|
|
113398
113416
|
else {
|
|
113399
|
-
if (currentTool === name || name === "explode") {
|
|
113400
|
-
this.viewer.toggleTab(false);
|
|
113401
|
-
}
|
|
113402
113417
|
if (name === "distance") {
|
|
113403
113418
|
this.viewer.cadTools.disable();
|
|
113404
113419
|
}
|
|
@@ -114944,9 +114959,6 @@ class Display {
|
|
|
114944
114959
|
["distance", "properties", "select"].includes(activeTool)) {
|
|
114945
114960
|
this.clickButtons[activeTool]?.set(false);
|
|
114946
114961
|
this.setTool(activeTool, false);
|
|
114947
|
-
// setTool→toggleTab(false) silently sets activeTab to "tree" (no notification).
|
|
114948
|
-
// Restore to "studio" so the next tab click correctly detects Studio as oldTab.
|
|
114949
|
-
this.state.set("activeTab", "studio", false);
|
|
114950
114962
|
}
|
|
114951
114963
|
// Hide tool buttons
|
|
114952
114964
|
this.showMeasureTools(false);
|
|
@@ -114962,22 +114974,6 @@ class Display {
|
|
|
114962
114974
|
this.showMeasureTools(this.measureTools);
|
|
114963
114975
|
this.showSelectTool(this.selectTool);
|
|
114964
114976
|
}
|
|
114965
|
-
/**
|
|
114966
|
-
* Entering Clip mode: hide the measure + select tool buttons (a measure/select
|
|
114967
|
-
* tool can't be active here — it disables the clip tab — but the buttons must not
|
|
114968
|
-
* be invocable while clipping). Mirrors {@link _deactivateToolsForStudio};
|
|
114969
|
-
* explode/zscale stay enabled for consistency with studio mode. Restored by
|
|
114970
|
-
* {@link _restoreToolsAfterClip} on leave.
|
|
114971
|
-
*/
|
|
114972
|
-
_deactivateToolsForClip() {
|
|
114973
|
-
this.showMeasureTools(false);
|
|
114974
|
-
this.showSelectTool(false);
|
|
114975
|
-
}
|
|
114976
|
-
/** Leaving Clip mode: restore measure + select buttons per their feature flags. */
|
|
114977
|
-
_restoreToolsAfterClip() {
|
|
114978
|
-
this.showMeasureTools(this.measureTools);
|
|
114979
|
-
this.showSelectTool(this.selectTool);
|
|
114980
|
-
}
|
|
114981
114977
|
/**
|
|
114982
114978
|
* Show/hide pinning button
|
|
114983
114979
|
*/
|
|
@@ -114997,9 +114993,6 @@ class Display {
|
|
|
114997
114993
|
if (oldTab === "zebra" && newTab !== "zebra") {
|
|
114998
114994
|
this.viewer.enableZebraTool(false);
|
|
114999
114995
|
}
|
|
115000
|
-
if (oldTab === "clip" && newTab !== "clip") {
|
|
115001
|
-
this._restoreToolsAfterClip();
|
|
115002
|
-
}
|
|
115003
114996
|
if (oldTab === "studio" && newTab !== "studio") {
|
|
115004
114997
|
this.closeMatEditor();
|
|
115005
114998
|
this._saveMatEditorChanges();
|
|
@@ -115038,7 +115031,6 @@ class Display {
|
|
|
115038
115031
|
}
|
|
115039
115032
|
else if (newTab === "clip") {
|
|
115040
115033
|
_updateVisibility(false, true, false, false, false);
|
|
115041
|
-
this._deactivateToolsForClip();
|
|
115042
115034
|
this.viewer.nestedGroup.setBackVisible(true);
|
|
115043
115035
|
const clipIntersection = this.viewer.state.get("clipIntersection");
|
|
115044
115036
|
if (typeof clipIntersection === "boolean") {
|