@xtctwins/tctwins-core 1.0.12 → 1.0.13

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.
@@ -122103,9 +122103,9 @@ class TreeViewPlugin extends Plugin {
122103
122103
  return;
122104
122104
  }
122105
122105
  this._muteSceneEvents = true;
122106
- const checkbox = event.target;//勾选框html对象
122107
- const visible = checkbox.checked;//获取勾选状态
122108
- const nodeId = checkbox.id.replace('checkbox-', ''); //获取勾选框对应节点id
122106
+ const checkbox = event.target; //勾选框html对象
122107
+ const visible = checkbox.checked; //获取勾选状态
122108
+ const nodeId = checkbox.id.replace("checkbox-", ""); //获取勾选框对应节点id
122109
122109
  const checkedNode = this._nodeNodes[nodeId];
122110
122110
  const objects = this._viewer.scene.objects;
122111
122111
  let numUpdated = 0;
@@ -122147,10 +122147,19 @@ class TreeViewPlugin extends Plugin {
122147
122147
  }
122148
122148
 
122149
122149
  // this._renderService.setCheckbox(parent.nodeId, (parent.numVisibleEntities > 0));
122150
-
122150
+ setCheckbox(parent.nodeId, parent.numVisibleEntities > 0);
122151
122151
  parent = parent.parent;
122152
122152
  }
122153
122153
  this._muteSceneEvents = false;
122154
+
122155
+ function setCheckbox(nodeId, checked) {
122156
+ const checkbox = document.getElementById(`checkbox-${nodeId}`);
122157
+ if (checkbox) {
122158
+ if (checked !== checkbox.checked) {
122159
+ checkbox.checked = checked;
122160
+ }
122161
+ }
122162
+ }
122154
122163
  }
122155
122164
 
122156
122165
  /**
@@ -122245,30 +122254,30 @@ class TreeViewPlugin extends Plugin {
122245
122254
  // this.expandToDepth(this._autoExpandDepth); //展开几层与否
122246
122255
  }
122247
122256
 
122248
- // //创建
122249
- // _createDisabledNodes() {
122250
- // const rootNode = this._renderService.createRootNode();
122251
- // this._rootElement = rootNode;
122252
- // this._containerElement.appendChild(rootNode);
122253
-
122254
- // const rootMetaObjects = this._viewer.metaScene.rootMetaObjects;
122255
-
122256
- // for (let objectId in rootMetaObjects) {
122257
- // const rootMetaObject = rootMetaObjects[objectId];
122258
- // const metaObjectType = rootMetaObject.type;
122259
- // const metaObjectName = rootMetaObject.name;
122260
- // const rootName =
122261
- // metaObjectName &&
122262
- // metaObjectName !== "" &&
122263
- // metaObjectName !== "Undefined" &&
122264
- // metaObjectName !== "Default"
122265
- // ? metaObjectName
122266
- // : metaObjectType;
122267
-
122268
- // // const childNode = this._renderService.createDisabledNodeElement(rootName);
122269
- // // rootNode.appendChild(childNode);
122270
- // }
122271
- // }
122257
+ // //创建
122258
+ // _createDisabledNodes() {
122259
+ // const rootNode = this._renderService.createRootNode();
122260
+ // this._rootElement = rootNode;
122261
+ // this._containerElement.appendChild(rootNode);
122262
+
122263
+ // const rootMetaObjects = this._viewer.metaScene.rootMetaObjects;
122264
+
122265
+ // for (let objectId in rootMetaObjects) {
122266
+ // const rootMetaObject = rootMetaObjects[objectId];
122267
+ // const metaObjectType = rootMetaObject.type;
122268
+ // const metaObjectName = rootMetaObject.name;
122269
+ // const rootName =
122270
+ // metaObjectName &&
122271
+ // metaObjectName !== "" &&
122272
+ // metaObjectName !== "Undefined" &&
122273
+ // metaObjectName !== "Default"
122274
+ // ? metaObjectName
122275
+ // : metaObjectType;
122276
+
122277
+ // // const childNode = this._renderService.createDisabledNodeElement(rootName);
122278
+ // // rootNode.appendChild(childNode);
122279
+ // }
122280
+ // }
122272
122281
 
122273
122282
  //创建storeys菜单的根节点
122274
122283
  _createStoreysNodes() {
@@ -122770,39 +122779,39 @@ class TreeViewPlugin extends Plugin {
122770
122779
  *
122771
122780
  * @param {Number} depth Depth to expand to.
122772
122781
  */
122773
- // expandToDepth(depth) {
122774
- // this.collapse();
122775
- // const expand = (node, countDepth) => {
122776
- // if (countDepth === depth) {
122777
- // return;
122778
- // }
122779
-
122780
- // // const switchElement = this._renderService.getSwitchElement(node.nodeId);
122781
- // if (switchElement) {
122782
- // this._expandSwitchElement(switchElement);
122783
- // const childNodes = node.children;
122784
- // for (var i = 0, len = childNodes.length; i < len; i++) {
122785
- // const childNode = childNodes[i];
122786
- // expand(childNode, countDepth + 1);
122787
- // }
122788
- // }
122789
- // };
122790
- // for (let i = 0, len = this._rootNodes.length; i < len; i++) {
122791
- // const rootNode = this._rootNodes[i];
122792
- // expand(rootNode, 0);
122793
- // }
122794
- // }
122782
+ // expandToDepth(depth) {
122783
+ // this.collapse();
122784
+ // const expand = (node, countDepth) => {
122785
+ // if (countDepth === depth) {
122786
+ // return;
122787
+ // }
122788
+
122789
+ // // const switchElement = this._renderService.getSwitchElement(node.nodeId);
122790
+ // if (switchElement) {
122791
+ // this._expandSwitchElement(switchElement);
122792
+ // const childNodes = node.children;
122793
+ // for (var i = 0, len = childNodes.length; i < len; i++) {
122794
+ // const childNode = childNodes[i];
122795
+ // expand(childNode, countDepth + 1);
122796
+ // }
122797
+ // }
122798
+ // };
122799
+ // for (let i = 0, len = this._rootNodes.length; i < len; i++) {
122800
+ // const rootNode = this._rootNodes[i];
122801
+ // expand(rootNode, 0);
122802
+ // }
122803
+ // }
122795
122804
 
122796
122805
  /**
122797
122806
  * Closes all the nodes in the tree.
122798
122807
  */
122799
- // collapse() {
122800
- // for (let i = 0, len = this._rootNodes.length; i < len; i++) {
122801
- // const rootNode = this._rootNodes[i];
122802
- // const objectId = rootNode.objectId;
122803
- // // this._collapseNode(objectId);
122804
- // }
122805
- // }
122808
+ // collapse() {
122809
+ // for (let i = 0, len = this._rootNodes.length; i < len; i++) {
122810
+ // const rootNode = this._rootNodes[i];
122811
+ // const objectId = rootNode.objectId;
122812
+ // // this._collapseNode(objectId);
122813
+ // }
122814
+ // }
122806
122815
 
122807
122816
  /**
122808
122817
  * Iterates over a subtree of the tree view's {@link TreeViewNode}s, calling the given callback for each
@@ -122836,7 +122845,7 @@ class TreeViewPlugin extends Plugin {
122836
122845
 
122837
122846
  /**
122838
122847
  * 获取指定id节点的children
122839
- * @param {*} nodeId
122848
+ * @param {*} nodeId
122840
122849
  * @returns node Children[]
122841
122850
  */
122842
122851
  getChildrenById(nodeId) {
@@ -122845,10 +122854,10 @@ class TreeViewPlugin extends Plugin {
122845
122854
 
122846
122855
  /**
122847
122856
  * 获取指定id的节点
122848
- * @param {*} nodeId
122849
- * @returns
122857
+ * @param {*} nodeId
122858
+ * @returns
122850
122859
  */
122851
- getNodeById(nodeId){
122860
+ getNodeById(nodeId) {
122852
122861
  return this._nodeNodes[nodeId];
122853
122862
  }
122854
122863
 
@@ -123040,7 +123049,6 @@ class TreeViewPlugin extends Plugin {
123040
123049
  // _collapseSwitchElement(switchElement) {
123041
123050
  // this._renderService.collapse(switchElement, this._switchExpandHandler, this._switchCollapseHandler);
123042
123051
  // }
123043
-
123044
123052
  }
123045
123053
 
123046
123054
  /**
@@ -122099,9 +122099,9 @@ class TreeViewPlugin extends Plugin {
122099
122099
  return;
122100
122100
  }
122101
122101
  this._muteSceneEvents = true;
122102
- const checkbox = event.target;//勾选框html对象
122103
- const visible = checkbox.checked;//获取勾选状态
122104
- const nodeId = checkbox.id.replace('checkbox-', ''); //获取勾选框对应节点id
122102
+ const checkbox = event.target; //勾选框html对象
122103
+ const visible = checkbox.checked; //获取勾选状态
122104
+ const nodeId = checkbox.id.replace("checkbox-", ""); //获取勾选框对应节点id
122105
122105
  const checkedNode = this._nodeNodes[nodeId];
122106
122106
  const objects = this._viewer.scene.objects;
122107
122107
  let numUpdated = 0;
@@ -122143,10 +122143,19 @@ class TreeViewPlugin extends Plugin {
122143
122143
  }
122144
122144
 
122145
122145
  // this._renderService.setCheckbox(parent.nodeId, (parent.numVisibleEntities > 0));
122146
-
122146
+ setCheckbox(parent.nodeId, parent.numVisibleEntities > 0);
122147
122147
  parent = parent.parent;
122148
122148
  }
122149
122149
  this._muteSceneEvents = false;
122150
+
122151
+ function setCheckbox(nodeId, checked) {
122152
+ const checkbox = document.getElementById(`checkbox-${nodeId}`);
122153
+ if (checkbox) {
122154
+ if (checked !== checkbox.checked) {
122155
+ checkbox.checked = checked;
122156
+ }
122157
+ }
122158
+ }
122150
122159
  }
122151
122160
 
122152
122161
  /**
@@ -122241,30 +122250,30 @@ class TreeViewPlugin extends Plugin {
122241
122250
  // this.expandToDepth(this._autoExpandDepth); //展开几层与否
122242
122251
  }
122243
122252
 
122244
- // //创建
122245
- // _createDisabledNodes() {
122246
- // const rootNode = this._renderService.createRootNode();
122247
- // this._rootElement = rootNode;
122248
- // this._containerElement.appendChild(rootNode);
122249
-
122250
- // const rootMetaObjects = this._viewer.metaScene.rootMetaObjects;
122251
-
122252
- // for (let objectId in rootMetaObjects) {
122253
- // const rootMetaObject = rootMetaObjects[objectId];
122254
- // const metaObjectType = rootMetaObject.type;
122255
- // const metaObjectName = rootMetaObject.name;
122256
- // const rootName =
122257
- // metaObjectName &&
122258
- // metaObjectName !== "" &&
122259
- // metaObjectName !== "Undefined" &&
122260
- // metaObjectName !== "Default"
122261
- // ? metaObjectName
122262
- // : metaObjectType;
122263
-
122264
- // // const childNode = this._renderService.createDisabledNodeElement(rootName);
122265
- // // rootNode.appendChild(childNode);
122266
- // }
122267
- // }
122253
+ // //创建
122254
+ // _createDisabledNodes() {
122255
+ // const rootNode = this._renderService.createRootNode();
122256
+ // this._rootElement = rootNode;
122257
+ // this._containerElement.appendChild(rootNode);
122258
+
122259
+ // const rootMetaObjects = this._viewer.metaScene.rootMetaObjects;
122260
+
122261
+ // for (let objectId in rootMetaObjects) {
122262
+ // const rootMetaObject = rootMetaObjects[objectId];
122263
+ // const metaObjectType = rootMetaObject.type;
122264
+ // const metaObjectName = rootMetaObject.name;
122265
+ // const rootName =
122266
+ // metaObjectName &&
122267
+ // metaObjectName !== "" &&
122268
+ // metaObjectName !== "Undefined" &&
122269
+ // metaObjectName !== "Default"
122270
+ // ? metaObjectName
122271
+ // : metaObjectType;
122272
+
122273
+ // // const childNode = this._renderService.createDisabledNodeElement(rootName);
122274
+ // // rootNode.appendChild(childNode);
122275
+ // }
122276
+ // }
122268
122277
 
122269
122278
  //创建storeys菜单的根节点
122270
122279
  _createStoreysNodes() {
@@ -122766,39 +122775,39 @@ class TreeViewPlugin extends Plugin {
122766
122775
  *
122767
122776
  * @param {Number} depth Depth to expand to.
122768
122777
  */
122769
- // expandToDepth(depth) {
122770
- // this.collapse();
122771
- // const expand = (node, countDepth) => {
122772
- // if (countDepth === depth) {
122773
- // return;
122774
- // }
122775
-
122776
- // // const switchElement = this._renderService.getSwitchElement(node.nodeId);
122777
- // if (switchElement) {
122778
- // this._expandSwitchElement(switchElement);
122779
- // const childNodes = node.children;
122780
- // for (var i = 0, len = childNodes.length; i < len; i++) {
122781
- // const childNode = childNodes[i];
122782
- // expand(childNode, countDepth + 1);
122783
- // }
122784
- // }
122785
- // };
122786
- // for (let i = 0, len = this._rootNodes.length; i < len; i++) {
122787
- // const rootNode = this._rootNodes[i];
122788
- // expand(rootNode, 0);
122789
- // }
122790
- // }
122778
+ // expandToDepth(depth) {
122779
+ // this.collapse();
122780
+ // const expand = (node, countDepth) => {
122781
+ // if (countDepth === depth) {
122782
+ // return;
122783
+ // }
122784
+
122785
+ // // const switchElement = this._renderService.getSwitchElement(node.nodeId);
122786
+ // if (switchElement) {
122787
+ // this._expandSwitchElement(switchElement);
122788
+ // const childNodes = node.children;
122789
+ // for (var i = 0, len = childNodes.length; i < len; i++) {
122790
+ // const childNode = childNodes[i];
122791
+ // expand(childNode, countDepth + 1);
122792
+ // }
122793
+ // }
122794
+ // };
122795
+ // for (let i = 0, len = this._rootNodes.length; i < len; i++) {
122796
+ // const rootNode = this._rootNodes[i];
122797
+ // expand(rootNode, 0);
122798
+ // }
122799
+ // }
122791
122800
 
122792
122801
  /**
122793
122802
  * Closes all the nodes in the tree.
122794
122803
  */
122795
- // collapse() {
122796
- // for (let i = 0, len = this._rootNodes.length; i < len; i++) {
122797
- // const rootNode = this._rootNodes[i];
122798
- // const objectId = rootNode.objectId;
122799
- // // this._collapseNode(objectId);
122800
- // }
122801
- // }
122804
+ // collapse() {
122805
+ // for (let i = 0, len = this._rootNodes.length; i < len; i++) {
122806
+ // const rootNode = this._rootNodes[i];
122807
+ // const objectId = rootNode.objectId;
122808
+ // // this._collapseNode(objectId);
122809
+ // }
122810
+ // }
122802
122811
 
122803
122812
  /**
122804
122813
  * Iterates over a subtree of the tree view's {@link TreeViewNode}s, calling the given callback for each
@@ -122832,7 +122841,7 @@ class TreeViewPlugin extends Plugin {
122832
122841
 
122833
122842
  /**
122834
122843
  * 获取指定id节点的children
122835
- * @param {*} nodeId
122844
+ * @param {*} nodeId
122836
122845
  * @returns node Children[]
122837
122846
  */
122838
122847
  getChildrenById(nodeId) {
@@ -122841,10 +122850,10 @@ class TreeViewPlugin extends Plugin {
122841
122850
 
122842
122851
  /**
122843
122852
  * 获取指定id的节点
122844
- * @param {*} nodeId
122845
- * @returns
122853
+ * @param {*} nodeId
122854
+ * @returns
122846
122855
  */
122847
- getNodeById(nodeId){
122856
+ getNodeById(nodeId) {
122848
122857
  return this._nodeNodes[nodeId];
122849
122858
  }
122850
122859
 
@@ -123036,7 +123045,6 @@ class TreeViewPlugin extends Plugin {
123036
123045
  // _collapseSwitchElement(switchElement) {
123037
123046
  // this._renderService.collapse(switchElement, this._switchExpandHandler, this._switchCollapseHandler);
123038
123047
  // }
123039
-
123040
123048
  }
123041
123049
 
123042
123050
  /**
@@ -26462,9 +26462,9 @@ this.fire("ExpandHandler",event);}//收起点击事件
26462
26462
  this.fire("CollapseHandler",event);}//勾选框点击事件
26463
26463
  },{key:"checkboxChangeHandler",value:function checkboxChangeHandler(event){this.fire("checkBoxChanged",event);if(this._muteTreeEvents){return;}this._muteSceneEvents=true;var checkbox=event.target;//勾选框html对象
26464
26464
  var visible=checkbox.checked;//获取勾选状态
26465
- var nodeId=checkbox.id.replace('checkbox-','');//获取勾选框对应节点id
26465
+ var nodeId=checkbox.id.replace("checkbox-","");//获取勾选框对应节点id
26466
26466
  var checkedNode=this._nodeNodes[nodeId];var objects=this._viewer.scene.objects;var numUpdated=0;this._withNodeTree(checkedNode,function(node){var objectId=node.objectId;var entity=objects[objectId];var isLeaf=node.children.length===0;node.numVisibleEntities=visible?node.numEntities:0;if(isLeaf&&visible!==node.checked){numUpdated++;}node.checked=visible;setCheckbox(node.nodeId,visible);if(entity){entity.visible=visible;}function setCheckbox(nodeId,checked){var checkbox=document.getElementById("checkbox-".concat(nodeId));if(checkbox){if(checked!==checkbox.checked){checkbox.checked=checked;}}}});var parent=checkedNode.parent;while(parent){parent.checked=visible;if(visible){parent.numVisibleEntities+=numUpdated;}else{parent.numVisibleEntities-=numUpdated;}// this._renderService.setCheckbox(parent.nodeId, (parent.numVisibleEntities > 0));
26467
- parent=parent.parent;}this._muteSceneEvents=false;}/**
26467
+ setCheckbox(parent.nodeId,parent.numVisibleEntities>0);parent=parent.parent;}this._muteSceneEvents=false;function setCheckbox(nodeId,checked){var checkbox=document.getElementById("checkbox-".concat(nodeId));if(checkbox){if(checked!==checkbox.checked){checkbox.checked=checked;}}}}/**
26468
26468
  * Sets how the nodes are organized within this tree view.
26469
26469
  *
26470
26470
  * Accepted values are:
@@ -26647,12 +26647,12 @@ this._showListItemElementId=null;}/**
26647
26647
  */},{key:"withNodeTree",value:function withNodeTree(node,callback){callback(node);var children=node.children;if(!children){return;}for(var _i570=0,len=children.length;_i570<len;_i570++){this.withNodeTree(children[_i570],callback);}}//遍历树指定节点下的子节点
26648
26648
  },{key:"_withNodeTree",value:function _withNodeTree(node,callback){callback(node);var children=node.children;if(!children){return;}for(var _i571=0,len=children.length;_i571<len;_i571++){this._withNodeTree(children[_i571],callback);}}/**
26649
26649
  * 获取指定id节点的children
26650
- * @param {*} nodeId
26650
+ * @param {*} nodeId
26651
26651
  * @returns node Children[]
26652
26652
  */},{key:"getChildrenById",value:function getChildrenById(nodeId){return this._nodeNodes[nodeId].children;}/**
26653
26653
  * 获取指定id的节点
26654
- * @param {*} nodeId
26655
- * @returns
26654
+ * @param {*} nodeId
26655
+ * @returns
26656
26656
  */},{key:"getNodeById",value:function getNodeById(nodeId){return this._nodeNodes[nodeId];}/**
26657
26657
  * Destroys this TreeViewPlugin.
26658
26658
  */},{key:"destroy",value:function destroy(){// if (!this._containerElement) {