lythreeframe 1.1.14 → 1.1.15

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.
@@ -1250,7 +1250,8 @@ const DefaultPostProcessParam = {
1250
1250
 
1251
1251
  class World {
1252
1252
  get scene() {
1253
- let scene = this.rootActor.scene;
1253
+ var _a;
1254
+ let scene = (_a = this.rootActor) === null || _a === void 0 ? void 0 : _a.scene;
1254
1255
  if (!scene) {
1255
1256
  throw new Error("scene is null");
1256
1257
  }
@@ -1284,19 +1285,22 @@ class World {
1284
1285
  });
1285
1286
  }
1286
1287
  destroy() {
1288
+ var _a;
1287
1289
  this.tickableActors.clear();
1288
1290
  this.actors.forEach((elem) => {
1289
1291
  elem.destroy();
1290
1292
  });
1291
1293
  this.actors.clear();
1292
- this.rootActor.destroy();
1294
+ (_a = this.rootActor) === null || _a === void 0 ? void 0 : _a.destroy();
1295
+ this.rootActor = null;
1293
1296
  }
1294
1297
  addActor(actor) {
1298
+ var _a;
1295
1299
  if (!actor.rootComponent.threeObject) {
1296
1300
  throw new Error("actor.threeObject is null");
1297
1301
  }
1298
1302
  actor.removeFromParent();
1299
- this.rootActor.addChildActor(actor);
1303
+ (_a = this.rootActor) === null || _a === void 0 ? void 0 : _a.addChildActor(actor, exports.AttachmentRules.KeepRelative);
1300
1304
  this.actors.add(actor);
1301
1305
  actor.onAddedToWorld(this);
1302
1306
  this.viewport.markRenderStateDirty();
@@ -1248,7 +1248,8 @@ const DefaultPostProcessParam = {
1248
1248
 
1249
1249
  class World {
1250
1250
  get scene() {
1251
- let scene = this.rootActor.scene;
1251
+ var _a;
1252
+ let scene = (_a = this.rootActor) === null || _a === void 0 ? void 0 : _a.scene;
1252
1253
  if (!scene) {
1253
1254
  throw new Error("scene is null");
1254
1255
  }
@@ -1282,19 +1283,22 @@ class World {
1282
1283
  });
1283
1284
  }
1284
1285
  destroy() {
1286
+ var _a;
1285
1287
  this.tickableActors.clear();
1286
1288
  this.actors.forEach((elem) => {
1287
1289
  elem.destroy();
1288
1290
  });
1289
1291
  this.actors.clear();
1290
- this.rootActor.destroy();
1292
+ (_a = this.rootActor) === null || _a === void 0 ? void 0 : _a.destroy();
1293
+ this.rootActor = null;
1291
1294
  }
1292
1295
  addActor(actor) {
1296
+ var _a;
1293
1297
  if (!actor.rootComponent.threeObject) {
1294
1298
  throw new Error("actor.threeObject is null");
1295
1299
  }
1296
1300
  actor.removeFromParent();
1297
- this.rootActor.addChildActor(actor);
1301
+ (_a = this.rootActor) === null || _a === void 0 ? void 0 : _a.addChildActor(actor, AttachmentRules.KeepRelative);
1298
1302
  this.actors.add(actor);
1299
1303
  actor.onAddedToWorld(this);
1300
1304
  this.viewport.markRenderStateDirty();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lythreeframe",
3
- "version": "1.1.14",
3
+ "version": "1.1.15",
4
4
  "description": "Three.js 封装",
5
5
  "main": "dist/bundle.cjs.js",
6
6
  "module": "dist/bundle.esm.js",