lythreeframe 1.2.45 → 1.2.46

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.
@@ -645,7 +645,6 @@ class SceneComponent extends Component {
645
645
  throw Error("targetComponent threeObject is invalid");
646
646
  }
647
647
  this.obj.remove(targetComponent.threeObject);
648
- console.log("removeChildComponent");
649
648
  targetComponent.destroy();
650
649
  }
651
650
  detachFromParentComponent() {
@@ -663,11 +662,17 @@ class SceneComponent extends Component {
663
662
  if (!this.obj) {
664
663
  return;
665
664
  }
665
+ let toDes = [];
666
666
  for (let i = 0; i < this.obj.children.length; ++i) {
667
667
  let obj = (_a = this.obj.children[i].userData) === null || _a === void 0 ? void 0 : _a.LYObject;
668
- if (obj)
669
- this.obj.children[i].userData.LYObject.destroy();
668
+ if (obj) {
669
+ toDes.push(obj);
670
+ }
670
671
  }
672
+ toDes.forEach((elem) => {
673
+ elem.destroy();
674
+ });
675
+ toDes = [];
671
676
  }
672
677
  /* horver */
673
678
  set isHoverEnabled(bCanHorver) {
@@ -643,7 +643,6 @@ class SceneComponent extends Component {
643
643
  throw Error("targetComponent threeObject is invalid");
644
644
  }
645
645
  this.obj.remove(targetComponent.threeObject);
646
- console.log("removeChildComponent");
647
646
  targetComponent.destroy();
648
647
  }
649
648
  detachFromParentComponent() {
@@ -661,11 +660,17 @@ class SceneComponent extends Component {
661
660
  if (!this.obj) {
662
661
  return;
663
662
  }
663
+ let toDes = [];
664
664
  for (let i = 0; i < this.obj.children.length; ++i) {
665
665
  let obj = (_a = this.obj.children[i].userData) === null || _a === void 0 ? void 0 : _a.LYObject;
666
- if (obj)
667
- this.obj.children[i].userData.LYObject.destroy();
666
+ if (obj) {
667
+ toDes.push(obj);
668
+ }
668
669
  }
670
+ toDes.forEach((elem) => {
671
+ elem.destroy();
672
+ });
673
+ toDes = [];
669
674
  }
670
675
  /* horver */
671
676
  set isHoverEnabled(bCanHorver) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lythreeframe",
3
- "version": "1.2.45",
3
+ "version": "1.2.46",
4
4
  "description": "Three.js 封装",
5
5
  "main": "dist/bundle.cjs.js",
6
6
  "module": "dist/bundle.esm.js",