three-cad-viewer 2.2.0 → 2.2.2

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.
@@ -58521,7 +58521,7 @@ class ObjectGroup extends Group {
58521
58521
  : this.alpha;
58522
58522
  }
58523
58523
  for (var child of this.children) {
58524
- if (!child.name.startsWith("clipping")){
58524
+ if (!child.name.startsWith("clipping")) {
58525
58525
  // turn depth write off for transparent objects
58526
58526
  child.material.depthWrite = this.alpha < 1.0 ? false : !flag;
58527
58527
  // but keep depth test
@@ -58560,6 +58560,12 @@ class ObjectGroup extends Group {
58560
58560
 
58561
58561
  setShapeVisible(flag) {
58562
58562
  this.types.front.material.visible = flag;
58563
+ for (var t of ["clipping-0", "clipping-1", "clipping-2"]) {
58564
+ if (this.types[t]) {
58565
+ this.types[t].children[0].material.visible = flag;
58566
+ this.types[t].children[1].material.visible = flag;
58567
+ }
58568
+ }
58563
58569
  if (this.types.back && this.renderback) {
58564
58570
  this.types.back.material.visible = flag;
58565
58571
  }
@@ -58902,9 +58908,7 @@ class NestedGroup {
58902
58908
  const backColor =
58903
58909
  group.subtype === "solid"
58904
58910
  ? color
58905
- : new Color(
58906
- Math.round(Math.min(0xffffff, this.edgeColor * 1.25)),
58907
- );
58911
+ : new Color(this.edgeColor).lerp(new Color(1, 1, 1), 0.15);
58908
58912
 
58909
58913
  const backMaterial = new MeshBasicMaterial({
58910
58914
  color: backColor,
@@ -62856,7 +62860,7 @@ class Camera {
62856
62860
  }
62857
62861
  }
62858
62862
 
62859
- const version = "2.2.0";
62863
+ const version = "2.2.2";
62860
62864
 
62861
62865
  class Viewer {
62862
62866
  /**
@@ -63961,6 +63965,9 @@ class Viewer {
63961
63965
 
63962
63966
  this.display.autoCollapse();
63963
63967
 
63968
+ // ensure all for all deselected objects the stencil planes are invisible
63969
+ this.setObjects(this.states, true, true);
63970
+
63964
63971
  //
63965
63972
  // show the rendering
63966
63973
  //
@@ -64125,12 +64132,12 @@ class Viewer {
64125
64132
  * @param {States} states
64126
64133
  * @param {boolean} [notify=true] - whether to send notification or not.
64127
64134
  */
64128
- setObjects = (states, notify = true) => {
64135
+ setObjects = (states, force = false, notify = true) => {
64129
64136
  for (var key in this.states) {
64130
64137
  var oldState = this.states[key];
64131
64138
  var newState = states[key];
64132
64139
  var objectGroup = this.nestedGroup.groups[key];
64133
- if (oldState[0] != newState[0]) {
64140
+ if (force || oldState[0] != newState[0]) {
64134
64141
  objectGroup.setShapeVisible(newState[0] === 1);
64135
64142
  this.states[key][0] = newState[0];
64136
64143
  }
@@ -64886,6 +64893,17 @@ class Viewer {
64886
64893
  return this.states;
64887
64894
  }
64888
64895
 
64896
+ /**
64897
+ * Get state of a treeview leafs for a path.
64898
+ * separator can be / or |
64899
+ * @param {string} path - path of the object
64900
+ * @returns {number[]} state value in the form of [mesh, edges] = [0/1, 0/1]
64901
+ **/
64902
+ getState(path) {
64903
+ var p = path.replaceAll("|", "/");
64904
+ return this.getStates()[p];
64905
+ }
64906
+
64889
64907
  /**
64890
64908
  * Set states of a treeview leafs
64891
64909
  * @function