three-cad-viewer 3.3.4 → 3.3.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/three-cad-viewer.esm.js +49 -18
- package/dist/three-cad-viewer.esm.min.js +1 -1
- package/dist/three-cad-viewer.js +49 -18
- package/dist/three-cad-viewer.min.js +1 -1
- package/package.json +2 -2
- package/src/_version.js +1 -1
- package/src/treeview.js +7 -2
- package/src/viewer.js +41 -15
|
@@ -61517,6 +61517,7 @@ class TreeView {
|
|
|
61517
61517
|
pickHandler,
|
|
61518
61518
|
updateHandler,
|
|
61519
61519
|
notificationHandler,
|
|
61520
|
+
colorGetter,
|
|
61520
61521
|
theme,
|
|
61521
61522
|
linkIcons,
|
|
61522
61523
|
debug = false,
|
|
@@ -61548,6 +61549,7 @@ class TreeView {
|
|
|
61548
61549
|
this.pickHandler = pickHandler;
|
|
61549
61550
|
this.updateHandler = updateHandler;
|
|
61550
61551
|
this.notificationHandler = notificationHandler;
|
|
61552
|
+
this.colorGetter = colorGetter;
|
|
61551
61553
|
this.theme = theme;
|
|
61552
61554
|
this.linkIcons = linkIcons;
|
|
61553
61555
|
this.debug = debug;
|
|
@@ -61923,8 +61925,11 @@ class TreeView {
|
|
|
61923
61925
|
|
|
61924
61926
|
const label = document.createElement("span");
|
|
61925
61927
|
label.className = "tv-node-label";
|
|
61926
|
-
label.
|
|
61927
|
-
|
|
61928
|
+
label.innerHTML = node.name;
|
|
61929
|
+
const color = this.colorGetter(node.path);
|
|
61930
|
+
if (color != null) {
|
|
61931
|
+
label.innerHTML += `<span style="color:${color}"> ⚈</span>`;
|
|
61932
|
+
}
|
|
61928
61933
|
label.onmousedown = (e) => {
|
|
61929
61934
|
e.preventDefault();
|
|
61930
61935
|
};
|
|
@@ -65051,7 +65056,7 @@ class Camera {
|
|
|
65051
65056
|
}
|
|
65052
65057
|
}
|
|
65053
65058
|
|
|
65054
|
-
const version = "3.3.
|
|
65059
|
+
const version = "3.3.5";
|
|
65055
65060
|
|
|
65056
65061
|
Mesh.prototype.dispose = function () {
|
|
65057
65062
|
if (this.geometry) {
|
|
@@ -65868,21 +65873,7 @@ class Viewer {
|
|
|
65868
65873
|
*/
|
|
65869
65874
|
dispose() {
|
|
65870
65875
|
this.clear();
|
|
65871
|
-
disposeShapes(this.shapes);
|
|
65872
|
-
this.shapes = null;
|
|
65873
65876
|
|
|
65874
|
-
if (this.expandedNestedGroup != null) {
|
|
65875
|
-
this.expandedNestedGroup.dispose();
|
|
65876
|
-
this.expandedNestedGroup = null;
|
|
65877
|
-
}
|
|
65878
|
-
if (this.compactNestedGroup != null) {
|
|
65879
|
-
this.compactNestedGroup.dispose();
|
|
65880
|
-
this.compactNestedGroup = null;
|
|
65881
|
-
}
|
|
65882
|
-
if (this.nestedGroup != null) {
|
|
65883
|
-
this.nestedGroup.dispose();
|
|
65884
|
-
this.nestedGroup = null;
|
|
65885
|
-
}
|
|
65886
65877
|
if (this.gridHelper) {
|
|
65887
65878
|
for (var i in this.gridHelper.gridHelper) {
|
|
65888
65879
|
this.gridHelper.gridHelper[i].dispose();
|
|
@@ -66005,6 +65996,24 @@ class Viewer {
|
|
|
66005
65996
|
this.scene = null;
|
|
66006
65997
|
this.ready = false;
|
|
66007
65998
|
}
|
|
65999
|
+
|
|
66000
|
+
if (this.shapes != null) {
|
|
66001
|
+
disposeShapes(this.shapes);
|
|
66002
|
+
this.shapes = null;
|
|
66003
|
+
}
|
|
66004
|
+
|
|
66005
|
+
if (this.expandedNestedGroup != null) {
|
|
66006
|
+
this.expandedNestedGroup.dispose();
|
|
66007
|
+
this.expandedNestedGroup = null;
|
|
66008
|
+
}
|
|
66009
|
+
if (this.compactNestedGroup != null) {
|
|
66010
|
+
this.compactNestedGroup.dispose();
|
|
66011
|
+
this.compactNestedGroup = null;
|
|
66012
|
+
}
|
|
66013
|
+
if (this.nestedGroup != null) {
|
|
66014
|
+
this.nestedGroup.dispose();
|
|
66015
|
+
this.nestedGroup = null;
|
|
66016
|
+
}
|
|
66008
66017
|
}
|
|
66009
66018
|
|
|
66010
66019
|
// - - - - - - - - - - - - - - - - - - - - - - - -
|
|
@@ -66066,6 +66075,27 @@ class Viewer {
|
|
|
66066
66075
|
}
|
|
66067
66076
|
};
|
|
66068
66077
|
|
|
66078
|
+
/**
|
|
66079
|
+
* Get the color of a node from its path
|
|
66080
|
+
* @param path - path of the CAD object
|
|
66081
|
+
*/
|
|
66082
|
+
getNodeColor = (path) => {
|
|
66083
|
+
var group = this.nestedGroup.groups["/" + path];
|
|
66084
|
+
if (group instanceof ObjectGroup) {
|
|
66085
|
+
let color = "";
|
|
66086
|
+
if (
|
|
66087
|
+
group.children[0].type !== "Mesh" ||
|
|
66088
|
+
group.children[0].material.name == "frontMaterial"
|
|
66089
|
+
) {
|
|
66090
|
+
color = group.children[0].material.color;
|
|
66091
|
+
} else {
|
|
66092
|
+
color = group.children[1].material.color;
|
|
66093
|
+
}
|
|
66094
|
+
return "#" + color.getHexString();
|
|
66095
|
+
}
|
|
66096
|
+
return null;
|
|
66097
|
+
};
|
|
66098
|
+
|
|
66069
66099
|
/**
|
|
66070
66100
|
* Toggle the two version of the NestedGroup
|
|
66071
66101
|
* @param expanded - whether to render the exploded or compact version
|
|
@@ -66128,6 +66158,7 @@ class Viewer {
|
|
|
66128
66158
|
this.handlePick,
|
|
66129
66159
|
this.update,
|
|
66130
66160
|
this.notifyStates,
|
|
66161
|
+
this.getNodeColor,
|
|
66131
66162
|
this.theme,
|
|
66132
66163
|
this.newTreeBehavior,
|
|
66133
66164
|
false,
|
|
@@ -66176,8 +66207,8 @@ class Viewer {
|
|
|
66176
66207
|
/**
|
|
66177
66208
|
* Render a CAD object and build the navigation tree
|
|
66178
66209
|
* @param {Shapes} shapes - the Shapes object representing the tessellated CAD object
|
|
66179
|
-
* @param {ViewerOptions} viewerOptions - the viewer options
|
|
66180
66210
|
* @param {RenderOptions} renderOptions - the render options
|
|
66211
|
+
* @param {ViewerOptions} viewerOptions - the viewer options
|
|
66181
66212
|
*/
|
|
66182
66213
|
render(shapes, renderOptions, viewerOptions) {
|
|
66183
66214
|
this.shapes = shapes;
|