three-cad-viewer 2.2.1 → 2.2.3

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.
@@ -58559,7 +58559,9 @@ class ObjectGroup extends Group {
58559
58559
  }
58560
58560
 
58561
58561
  setShapeVisible(flag) {
58562
- this.types.front.material.visible = flag;
58562
+ if (this.types.front) {
58563
+ this.types.front.material.visible = flag;
58564
+ }
58563
58565
  for (var t of ["clipping-0", "clipping-1", "clipping-2"]) {
58564
58566
  if (this.types[t]) {
58565
58567
  this.types[t].children[0].material.visible = flag;
@@ -62860,7 +62862,7 @@ class Camera {
62860
62862
  }
62861
62863
  }
62862
62864
 
62863
- const version = "2.2.1";
62865
+ const version = "2.2.3";
62864
62866
 
62865
62867
  class Viewer {
62866
62868
  /**
@@ -63965,6 +63967,9 @@ class Viewer {
63965
63967
 
63966
63968
  this.display.autoCollapse();
63967
63969
 
63970
+ // ensure all for all deselected objects the stencil planes are invisible
63971
+ this.setObjects(this.states, true, true);
63972
+
63968
63973
  //
63969
63974
  // show the rendering
63970
63975
  //
@@ -64129,12 +64134,12 @@ class Viewer {
64129
64134
  * @param {States} states
64130
64135
  * @param {boolean} [notify=true] - whether to send notification or not.
64131
64136
  */
64132
- setObjects = (states, notify = true) => {
64137
+ setObjects = (states, force = false, notify = true) => {
64133
64138
  for (var key in this.states) {
64134
64139
  var oldState = this.states[key];
64135
64140
  var newState = states[key];
64136
64141
  var objectGroup = this.nestedGroup.groups[key];
64137
- if (oldState[0] != newState[0]) {
64142
+ if (force || oldState[0] != newState[0]) {
64138
64143
  objectGroup.setShapeVisible(newState[0] === 1);
64139
64144
  this.states[key][0] = newState[0];
64140
64145
  }
@@ -64890,6 +64895,17 @@ class Viewer {
64890
64895
  return this.states;
64891
64896
  }
64892
64897
 
64898
+ /**
64899
+ * Get state of a treeview leafs for a path.
64900
+ * separator can be / or |
64901
+ * @param {string} path - path of the object
64902
+ * @returns {number[]} state value in the form of [mesh, edges] = [0/1, 0/1]
64903
+ **/
64904
+ getState(path) {
64905
+ var p = path.replaceAll("|", "/");
64906
+ return this.getStates()[p];
64907
+ }
64908
+
64893
64909
  /**
64894
64910
  * Set states of a treeview leafs
64895
64911
  * @function