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
package/dist/three-cad-viewer.js
CHANGED
|
@@ -82241,6 +82241,7 @@ void main() {
|
|
|
82241
82241
|
this._cadOriginalBackColor = null;
|
|
82242
82242
|
this._isStudioMode = false;
|
|
82243
82243
|
this._cadEdgesVisible = null;
|
|
82244
|
+
this._cadVerticesVisible = null;
|
|
82244
82245
|
}
|
|
82245
82246
|
/**
|
|
82246
82247
|
* Get the zebra tool, creating it on first access.
|
|
@@ -82282,6 +82283,7 @@ void main() {
|
|
|
82282
82283
|
this._cadOriginalBackColor = null;
|
|
82283
82284
|
this._isStudioMode = false;
|
|
82284
82285
|
this._cadEdgesVisible = null;
|
|
82286
|
+
this._cadVerticesVisible = null;
|
|
82285
82287
|
}
|
|
82286
82288
|
/**
|
|
82287
82289
|
* Set the front face mesh.
|
|
@@ -82637,7 +82639,13 @@ void main() {
|
|
|
82637
82639
|
}
|
|
82638
82640
|
}
|
|
82639
82641
|
if (this.vertices) {
|
|
82640
|
-
this.
|
|
82642
|
+
if (this._isStudioMode) {
|
|
82643
|
+
// Same rule as edges: Studio hides vertices, record the CAD intent only.
|
|
82644
|
+
this._cadVerticesVisible = flag;
|
|
82645
|
+
}
|
|
82646
|
+
else {
|
|
82647
|
+
this.vertices.material.visible = flag;
|
|
82648
|
+
}
|
|
82641
82649
|
}
|
|
82642
82650
|
this._syncPickVertices();
|
|
82643
82651
|
}
|
|
@@ -82846,10 +82854,14 @@ void main() {
|
|
|
82846
82854
|
this._cadOriginalBackColor = this.originalBackColor
|
|
82847
82855
|
? this.originalBackColor.clone()
|
|
82848
82856
|
: null;
|
|
82849
|
-
// Save edge visibility state
|
|
82857
|
+
// Save edge and vertex visibility state (also for edge-only / vertex-only
|
|
82858
|
+
// groups, which have no front mesh and get no studio material)
|
|
82850
82859
|
this._cadEdgesVisible = this.edgeMaterial
|
|
82851
82860
|
? this.edgeMaterial.visible
|
|
82852
82861
|
: null;
|
|
82862
|
+
this._cadVerticesVisible = this.vertices
|
|
82863
|
+
? this.vertices.material.visible
|
|
82864
|
+
: null;
|
|
82853
82865
|
// --- Swap front material ---
|
|
82854
82866
|
if (this.front && studioFront) {
|
|
82855
82867
|
// Transfer per-object visibility to mesh.visible (NOT material.visible)
|
|
@@ -82903,24 +82915,30 @@ void main() {
|
|
|
82903
82915
|
if (this._cadOriginalBackColor) {
|
|
82904
82916
|
this.originalBackColor = this._cadOriginalBackColor.clone();
|
|
82905
82917
|
}
|
|
82906
|
-
// --- Restore edge visibility ---
|
|
82918
|
+
// --- Restore edge and vertex visibility ---
|
|
82907
82919
|
if (this.edgeMaterial && this._cadEdgesVisible !== null) {
|
|
82908
82920
|
this.edgeMaterial.visible = this._cadEdgesVisible;
|
|
82909
82921
|
}
|
|
82922
|
+
if (this.vertices && this._cadVerticesVisible !== null) {
|
|
82923
|
+
this.vertices.material.visible = this._cadVerticesVisible;
|
|
82924
|
+
}
|
|
82910
82925
|
this._isStudioMode = false;
|
|
82911
82926
|
}
|
|
82912
82927
|
/**
|
|
82913
|
-
* Toggle edge visibility while in Studio mode.
|
|
82928
|
+
* Toggle edge and vertex visibility while in Studio mode.
|
|
82914
82929
|
*
|
|
82915
|
-
*
|
|
82916
|
-
*
|
|
82930
|
+
* Should only be called while in Studio mode; the saved CAD edge/vertex
|
|
82931
|
+
* visibility is not affected and is restored by `leaveStudioMode()`.
|
|
82917
82932
|
*
|
|
82918
|
-
* @param visible - Whether edges should be visible
|
|
82933
|
+
* @param visible - Whether edges and vertices should be visible
|
|
82919
82934
|
*/
|
|
82920
82935
|
setStudioShowEdges(visible) {
|
|
82921
82936
|
if (this.edgeMaterial) {
|
|
82922
82937
|
this.edgeMaterial.visible = visible;
|
|
82923
82938
|
}
|
|
82939
|
+
if (this.vertices) {
|
|
82940
|
+
this.vertices.material.visible = visible;
|
|
82941
|
+
}
|
|
82924
82942
|
}
|
|
82925
82943
|
}
|
|
82926
82944
|
/**
|
|
@@ -88258,13 +88276,17 @@ float metalnessFactor = metalness;
|
|
|
88258
88276
|
}
|
|
88259
88277
|
// Track material tags that failed to resolve
|
|
88260
88278
|
const unresolvedTags = new Set();
|
|
88261
|
-
// Iterate all ObjectGroups with front meshes
|
|
88262
88279
|
for (const path in this.groups) {
|
|
88263
88280
|
const obj = this.groups[path];
|
|
88264
88281
|
if (!(obj instanceof ObjectGroup))
|
|
88265
88282
|
continue;
|
|
88266
|
-
if (!obj.front)
|
|
88283
|
+
if (!obj.front) {
|
|
88284
|
+
// Edge-only / vertex-only group: no studio material, but it must still
|
|
88285
|
+
// enter studio mode so its CAD edge/vertex visibility is saved and
|
|
88286
|
+
// restored on leave (setStudioShowEdges hides both in studio).
|
|
88287
|
+
obj.enterStudioMode(null, null);
|
|
88267
88288
|
continue;
|
|
88289
|
+
}
|
|
88268
88290
|
// Determine material tag, leaf color, and leaf alpha
|
|
88269
88291
|
const tag = obj.materialTag || "";
|
|
88270
88292
|
const leafColor = obj.originalColor
|
|
@@ -97334,7 +97356,7 @@ float metalnessFactor = metalness;
|
|
|
97334
97356
|
}
|
|
97335
97357
|
}
|
|
97336
97358
|
|
|
97337
|
-
const version = "5.0.
|
|
97359
|
+
const version = "5.0.5";
|
|
97338
97360
|
|
|
97339
97361
|
/**
|
|
97340
97362
|
* `PickedComponent` over a GPU id-pick result. Drives the shader
|
|
@@ -113371,6 +113393,8 @@ void mainImage(const in vec4 inputColor, const in vec2 uv, const in float depth,
|
|
|
113371
113393
|
/**
|
|
113372
113394
|
* Checkbox Handler for setting the tools mode.
|
|
113373
113395
|
* Delegates state mutations to Viewer.activateTool() to maintain unidirectional data flow.
|
|
113396
|
+
* The active tab is left untouched: a measure/select tool can run on any tab,
|
|
113397
|
+
* including Clip, so a sectioned model can be measured.
|
|
113374
113398
|
*/
|
|
113375
113399
|
this.setTool = (name, flag) => {
|
|
113376
113400
|
// Block tool activation while Studio mode is active
|
|
@@ -113378,15 +113402,9 @@ void mainImage(const in vec4 inputColor, const in vec2 uv, const in float depth,
|
|
|
113378
113402
|
return;
|
|
113379
113403
|
}
|
|
113380
113404
|
this.viewer.toggleAnimationLoop(flag);
|
|
113381
|
-
const activeTool = this.state.get("activeTool");
|
|
113382
|
-
const currentTool = typeof activeTool === "string" ? activeTool : "";
|
|
113383
113405
|
if (flag) {
|
|
113384
113406
|
// Delegate state mutations to Viewer
|
|
113385
113407
|
this.viewer.activateTool(name, true);
|
|
113386
|
-
if (["distance", "properties", "select"].includes(name) &&
|
|
113387
|
-
!["distance", "properties", "select"].includes(currentTool)) {
|
|
113388
|
-
this.viewer.toggleTab(true);
|
|
113389
|
-
}
|
|
113390
113408
|
this.viewer.setSelectionInput(flag);
|
|
113391
113409
|
if (name === "distance") {
|
|
113392
113410
|
this.viewer.cadTools.enable(ToolTypes.DISTANCE);
|
|
@@ -113402,9 +113420,6 @@ void mainImage(const in vec4 inputColor, const in vec2 uv, const in float depth,
|
|
|
113402
113420
|
}
|
|
113403
113421
|
}
|
|
113404
113422
|
else {
|
|
113405
|
-
if (currentTool === name || name === "explode") {
|
|
113406
|
-
this.viewer.toggleTab(false);
|
|
113407
|
-
}
|
|
113408
113423
|
if (name === "distance") {
|
|
113409
113424
|
this.viewer.cadTools.disable();
|
|
113410
113425
|
}
|
|
@@ -114950,9 +114965,6 @@ void mainImage(const in vec4 inputColor, const in vec2 uv, const in float depth,
|
|
|
114950
114965
|
["distance", "properties", "select"].includes(activeTool)) {
|
|
114951
114966
|
this.clickButtons[activeTool]?.set(false);
|
|
114952
114967
|
this.setTool(activeTool, false);
|
|
114953
|
-
// setTool→toggleTab(false) silently sets activeTab to "tree" (no notification).
|
|
114954
|
-
// Restore to "studio" so the next tab click correctly detects Studio as oldTab.
|
|
114955
|
-
this.state.set("activeTab", "studio", false);
|
|
114956
114968
|
}
|
|
114957
114969
|
// Hide tool buttons
|
|
114958
114970
|
this.showMeasureTools(false);
|
|
@@ -114968,22 +114980,6 @@ void mainImage(const in vec4 inputColor, const in vec2 uv, const in float depth,
|
|
|
114968
114980
|
this.showMeasureTools(this.measureTools);
|
|
114969
114981
|
this.showSelectTool(this.selectTool);
|
|
114970
114982
|
}
|
|
114971
|
-
/**
|
|
114972
|
-
* Entering Clip mode: hide the measure + select tool buttons (a measure/select
|
|
114973
|
-
* tool can't be active here — it disables the clip tab — but the buttons must not
|
|
114974
|
-
* be invocable while clipping). Mirrors {@link _deactivateToolsForStudio};
|
|
114975
|
-
* explode/zscale stay enabled for consistency with studio mode. Restored by
|
|
114976
|
-
* {@link _restoreToolsAfterClip} on leave.
|
|
114977
|
-
*/
|
|
114978
|
-
_deactivateToolsForClip() {
|
|
114979
|
-
this.showMeasureTools(false);
|
|
114980
|
-
this.showSelectTool(false);
|
|
114981
|
-
}
|
|
114982
|
-
/** Leaving Clip mode: restore measure + select buttons per their feature flags. */
|
|
114983
|
-
_restoreToolsAfterClip() {
|
|
114984
|
-
this.showMeasureTools(this.measureTools);
|
|
114985
|
-
this.showSelectTool(this.selectTool);
|
|
114986
|
-
}
|
|
114987
114983
|
/**
|
|
114988
114984
|
* Show/hide pinning button
|
|
114989
114985
|
*/
|
|
@@ -115003,9 +114999,6 @@ void mainImage(const in vec4 inputColor, const in vec2 uv, const in float depth,
|
|
|
115003
114999
|
if (oldTab === "zebra" && newTab !== "zebra") {
|
|
115004
115000
|
this.viewer.enableZebraTool(false);
|
|
115005
115001
|
}
|
|
115006
|
-
if (oldTab === "clip" && newTab !== "clip") {
|
|
115007
|
-
this._restoreToolsAfterClip();
|
|
115008
|
-
}
|
|
115009
115002
|
if (oldTab === "studio" && newTab !== "studio") {
|
|
115010
115003
|
this.closeMatEditor();
|
|
115011
115004
|
this._saveMatEditorChanges();
|
|
@@ -115044,7 +115037,6 @@ void mainImage(const in vec4 inputColor, const in vec2 uv, const in float depth,
|
|
|
115044
115037
|
}
|
|
115045
115038
|
else if (newTab === "clip") {
|
|
115046
115039
|
_updateVisibility(false, true, false, false, false);
|
|
115047
|
-
this._deactivateToolsForClip();
|
|
115048
115040
|
this.viewer.nestedGroup.setBackVisible(true);
|
|
115049
115041
|
const clipIntersection = this.viewer.state.get("clipIntersection");
|
|
115050
115042
|
if (typeof clipIntersection === "boolean") {
|