lythreeframe 1.2.61 → 1.2.62

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.
@@ -310,12 +310,15 @@ class SceneComponent extends Component {
310
310
  }
311
311
  }
312
312
  setPosition(...args) {
313
+ var _a;
313
314
  if (!this.obj) {
314
315
  throw Error("threeObject is invalid");
315
316
  }
316
317
  let newPosition = null;
317
- if (args.length === 1 && args[0] instanceof webgpu.Vector3) {
318
- newPosition = new webgpu.Vector3().copy(args[0]);
318
+ // 使用 isVector3 属性检查,避免多个 Three.js 实例导致 instanceof 失败
319
+ if (args.length === 1 && ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.isVector3)) {
320
+ const vec = args[0];
321
+ newPosition = new webgpu.Vector3(vec.x, vec.y, vec.z);
319
322
  }
320
323
  else if (args.length === 3 &&
321
324
  typeof args[0] === "number" &&
@@ -353,14 +356,17 @@ class SceneComponent extends Component {
353
356
  }
354
357
  }
355
358
  setRotation(...args) {
359
+ var _a;
356
360
  if (!this.obj) {
357
361
  throw Error("threeObject is invalid");
358
362
  }
359
363
  let newRotation = null;
360
- if (args[0] instanceof webgpu.Euler) {
361
- newRotation = new webgpu.Euler().copy(args[0]);
364
+ // 使用 isEuler 属性检查,避免多个 Three.js 实例导致 instanceof 失败
365
+ if ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.isEuler) {
366
+ const euler = args[0];
367
+ newRotation = new webgpu.Euler(euler.x, euler.y, euler.z, euler.order);
362
368
  }
363
- if (typeof (args[0]) === "number" && typeof (args[1]) === "number" && typeof (args[2]) === "number") {
369
+ else if (typeof (args[0]) === "number" && typeof (args[1]) === "number" && typeof (args[2]) === "number") {
364
370
  newRotation = new webgpu.Euler(args[0], args[1], args[2]);
365
371
  }
366
372
  if (!newRotation) {
@@ -390,14 +396,17 @@ class SceneComponent extends Component {
390
396
  }
391
397
  }
392
398
  setQuaternion(...args) {
399
+ var _a;
393
400
  if (!this.obj) {
394
401
  throw Error("threeObject is invalid");
395
402
  }
396
403
  let newQuat = null;
397
- if (args[0] instanceof webgpu.Quaternion) {
398
- newQuat = new webgpu.Quaternion().copy(args[0]);
404
+ // 使用 isQuaternion 属性检查,避免多个 Three.js 实例导致 instanceof 失败
405
+ if ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.isQuaternion) {
406
+ const q = args[0];
407
+ newQuat = new webgpu.Quaternion(q.x, q.y, q.z, q.w);
399
408
  }
400
- if (typeof args[0] === "number" && typeof args[1] === "number" && typeof args[2] === "number" && typeof args[3] === "number") {
409
+ else if (typeof args[0] === "number" && typeof args[1] === "number" && typeof args[2] === "number" && typeof args[3] === "number") {
401
410
  newQuat = new webgpu.Quaternion(args[0], args[1], args[2], args[3]);
402
411
  }
403
412
  if (!newQuat) {
@@ -435,14 +444,17 @@ class SceneComponent extends Component {
435
444
  }
436
445
  }
437
446
  setScale(...args) {
447
+ var _a;
438
448
  if (!this.obj) {
439
449
  throw Error("threeObject is invalid");
440
450
  }
441
451
  let newScale = null;
442
- if (args[0] instanceof webgpu.Vector3) {
443
- newScale = new webgpu.Vector3().copy(args[0]);
452
+ // 使用 isVector3 属性检查,避免多个 Three.js 实例导致 instanceof 失败
453
+ if ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.isVector3) {
454
+ const vec = args[0];
455
+ newScale = new webgpu.Vector3(vec.x, vec.y, vec.z);
444
456
  }
445
- if (typeof (args[0]) === "number" && typeof (args[1]) === "number" && typeof (args[2]) === "number") {
457
+ else if (typeof (args[0]) === "number" && typeof (args[1]) === "number" && typeof (args[2]) === "number") {
446
458
  newScale = new webgpu.Vector3(args[0], args[1], args[2]);
447
459
  }
448
460
  if (!newScale) {
@@ -2088,7 +2100,8 @@ class Orbital extends Pawn {
2088
2100
  focusTo(targetPos, targetQuat, distance, time, onGoing = null, onFinished = null) {
2089
2101
  this.stopFocusing();
2090
2102
  let finalQuat = null;
2091
- if (targetQuat instanceof webgpu.Euler) {
2103
+ // 使用 isEuler 属性检查,避免多个 Three.js 实例导致 instanceof 失败
2104
+ if (targetQuat === null || targetQuat === void 0 ? void 0 : targetQuat.isEuler) {
2092
2105
  finalQuat = new webgpu.Quaternion().setFromEuler(targetQuat);
2093
2106
  }
2094
2107
  else {
@@ -308,12 +308,15 @@ class SceneComponent extends Component {
308
308
  }
309
309
  }
310
310
  setPosition(...args) {
311
+ var _a;
311
312
  if (!this.obj) {
312
313
  throw Error("threeObject is invalid");
313
314
  }
314
315
  let newPosition = null;
315
- if (args.length === 1 && args[0] instanceof Vector3) {
316
- newPosition = new Vector3().copy(args[0]);
316
+ // 使用 isVector3 属性检查,避免多个 Three.js 实例导致 instanceof 失败
317
+ if (args.length === 1 && ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.isVector3)) {
318
+ const vec = args[0];
319
+ newPosition = new Vector3(vec.x, vec.y, vec.z);
317
320
  }
318
321
  else if (args.length === 3 &&
319
322
  typeof args[0] === "number" &&
@@ -351,14 +354,17 @@ class SceneComponent extends Component {
351
354
  }
352
355
  }
353
356
  setRotation(...args) {
357
+ var _a;
354
358
  if (!this.obj) {
355
359
  throw Error("threeObject is invalid");
356
360
  }
357
361
  let newRotation = null;
358
- if (args[0] instanceof Euler) {
359
- newRotation = new Euler().copy(args[0]);
362
+ // 使用 isEuler 属性检查,避免多个 Three.js 实例导致 instanceof 失败
363
+ if ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.isEuler) {
364
+ const euler = args[0];
365
+ newRotation = new Euler(euler.x, euler.y, euler.z, euler.order);
360
366
  }
361
- if (typeof (args[0]) === "number" && typeof (args[1]) === "number" && typeof (args[2]) === "number") {
367
+ else if (typeof (args[0]) === "number" && typeof (args[1]) === "number" && typeof (args[2]) === "number") {
362
368
  newRotation = new Euler(args[0], args[1], args[2]);
363
369
  }
364
370
  if (!newRotation) {
@@ -388,14 +394,17 @@ class SceneComponent extends Component {
388
394
  }
389
395
  }
390
396
  setQuaternion(...args) {
397
+ var _a;
391
398
  if (!this.obj) {
392
399
  throw Error("threeObject is invalid");
393
400
  }
394
401
  let newQuat = null;
395
- if (args[0] instanceof Quaternion) {
396
- newQuat = new Quaternion().copy(args[0]);
402
+ // 使用 isQuaternion 属性检查,避免多个 Three.js 实例导致 instanceof 失败
403
+ if ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.isQuaternion) {
404
+ const q = args[0];
405
+ newQuat = new Quaternion(q.x, q.y, q.z, q.w);
397
406
  }
398
- if (typeof args[0] === "number" && typeof args[1] === "number" && typeof args[2] === "number" && typeof args[3] === "number") {
407
+ else if (typeof args[0] === "number" && typeof args[1] === "number" && typeof args[2] === "number" && typeof args[3] === "number") {
399
408
  newQuat = new Quaternion(args[0], args[1], args[2], args[3]);
400
409
  }
401
410
  if (!newQuat) {
@@ -433,14 +442,17 @@ class SceneComponent extends Component {
433
442
  }
434
443
  }
435
444
  setScale(...args) {
445
+ var _a;
436
446
  if (!this.obj) {
437
447
  throw Error("threeObject is invalid");
438
448
  }
439
449
  let newScale = null;
440
- if (args[0] instanceof Vector3) {
441
- newScale = new Vector3().copy(args[0]);
450
+ // 使用 isVector3 属性检查,避免多个 Three.js 实例导致 instanceof 失败
451
+ if ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.isVector3) {
452
+ const vec = args[0];
453
+ newScale = new Vector3(vec.x, vec.y, vec.z);
442
454
  }
443
- if (typeof (args[0]) === "number" && typeof (args[1]) === "number" && typeof (args[2]) === "number") {
455
+ else if (typeof (args[0]) === "number" && typeof (args[1]) === "number" && typeof (args[2]) === "number") {
444
456
  newScale = new Vector3(args[0], args[1], args[2]);
445
457
  }
446
458
  if (!newScale) {
@@ -2086,7 +2098,8 @@ class Orbital extends Pawn {
2086
2098
  focusTo(targetPos, targetQuat, distance, time, onGoing = null, onFinished = null) {
2087
2099
  this.stopFocusing();
2088
2100
  let finalQuat = null;
2089
- if (targetQuat instanceof Euler) {
2101
+ // 使用 isEuler 属性检查,避免多个 Three.js 实例导致 instanceof 失败
2102
+ if (targetQuat === null || targetQuat === void 0 ? void 0 : targetQuat.isEuler) {
2090
2103
  finalQuat = new Quaternion().setFromEuler(targetQuat);
2091
2104
  }
2092
2105
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lythreeframe",
3
- "version": "1.2.61",
3
+ "version": "1.2.62",
4
4
  "description": "Three.js 封装",
5
5
  "main": "dist/bundle.cjs.js",
6
6
  "module": "dist/bundle.esm.js",