lythreeframe 1.2.67 → 1.2.68

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.
@@ -1087,9 +1087,48 @@ class AssetManager {
1087
1087
  }
1088
1088
  setupDracoLoader(dracoPath) {
1089
1089
  if (!this.dracoLoader) {
1090
- this.dracoLoader = new Addons_js.DRACOLoader(this.loadingManager);
1090
+ // Create DRACOLoader without passing LoadingManager
1091
+ this.dracoLoader = new Addons_js.DRACOLoader();
1092
+ // Clear manager callbacks to avoid Worker cloning issues
1093
+ if (this.dracoLoader.manager) {
1094
+ const manager = this.dracoLoader.manager;
1095
+ manager.onStart = undefined;
1096
+ manager.onLoad = undefined;
1097
+ manager.onProgress = undefined;
1098
+ manager.onError = undefined;
1099
+ }
1091
1100
  this.dracoLoader.setDecoderPath(dracoPath);
1092
- this.dracoLoader.setDecoderConfig({ type: "js" });
1101
+ // Intercept Worker creation to fix Vue reactivity issues
1102
+ const OriginalWorker = window.Worker;
1103
+ if (OriginalWorker && !OriginalWorker._dracoPatched) {
1104
+ OriginalWorker._dracoPatched = true;
1105
+ window.Worker = function (scriptURL, options) {
1106
+ const worker = new OriginalWorker(scriptURL, options);
1107
+ const originalPostMessage = worker.postMessage.bind(worker);
1108
+ worker.postMessage = function (message, transfer) {
1109
+ // Fix decoderConfig if it exists and is a Vue proxy
1110
+ if (message && message.decoderConfig && typeof message.decoderConfig === 'object') {
1111
+ const config = message.decoderConfig;
1112
+ const plainConfig = {};
1113
+ // Copy all properties to create a plain object
1114
+ for (const key in config) {
1115
+ if (Object.prototype.hasOwnProperty.call(config, key)) {
1116
+ plainConfig[key] = config[key];
1117
+ }
1118
+ }
1119
+ message = Object.assign(Object.assign({}, message), { decoderConfig: plainConfig });
1120
+ }
1121
+ return originalPostMessage(message, transfer);
1122
+ };
1123
+ return worker;
1124
+ };
1125
+ // Copy static properties
1126
+ for (const key in OriginalWorker) {
1127
+ if (Object.prototype.hasOwnProperty.call(OriginalWorker, key)) {
1128
+ window.Worker[key] = OriginalWorker[key];
1129
+ }
1130
+ }
1131
+ }
1093
1132
  this.dracoLoader.preload();
1094
1133
  this.gltfLoader.setDRACOLoader(this.dracoLoader);
1095
1134
  }
@@ -2474,7 +2513,7 @@ class Controller {
2474
2513
  this.fireComponentClick(component, hit, isDoubleClick);
2475
2514
  // Actor level
2476
2515
  const actor = component.parentActor;
2477
- //console.log("[Controller]fireClickEvents", actor, actor?.isClickEnabled)
2516
+ console.log("[Controller]fireClickEvents", actor, actor === null || actor === void 0 ? void 0 : actor.isClickEnabled);
2478
2517
  if (actor && actor.isClickEnabled) {
2479
2518
  this.fireActorClick(actor, component, hit, isDoubleClick);
2480
2519
  }
@@ -1085,9 +1085,48 @@ class AssetManager {
1085
1085
  }
1086
1086
  setupDracoLoader(dracoPath) {
1087
1087
  if (!this.dracoLoader) {
1088
- this.dracoLoader = new DRACOLoader(this.loadingManager);
1088
+ // Create DRACOLoader without passing LoadingManager
1089
+ this.dracoLoader = new DRACOLoader();
1090
+ // Clear manager callbacks to avoid Worker cloning issues
1091
+ if (this.dracoLoader.manager) {
1092
+ const manager = this.dracoLoader.manager;
1093
+ manager.onStart = undefined;
1094
+ manager.onLoad = undefined;
1095
+ manager.onProgress = undefined;
1096
+ manager.onError = undefined;
1097
+ }
1089
1098
  this.dracoLoader.setDecoderPath(dracoPath);
1090
- this.dracoLoader.setDecoderConfig({ type: "js" });
1099
+ // Intercept Worker creation to fix Vue reactivity issues
1100
+ const OriginalWorker = window.Worker;
1101
+ if (OriginalWorker && !OriginalWorker._dracoPatched) {
1102
+ OriginalWorker._dracoPatched = true;
1103
+ window.Worker = function (scriptURL, options) {
1104
+ const worker = new OriginalWorker(scriptURL, options);
1105
+ const originalPostMessage = worker.postMessage.bind(worker);
1106
+ worker.postMessage = function (message, transfer) {
1107
+ // Fix decoderConfig if it exists and is a Vue proxy
1108
+ if (message && message.decoderConfig && typeof message.decoderConfig === 'object') {
1109
+ const config = message.decoderConfig;
1110
+ const plainConfig = {};
1111
+ // Copy all properties to create a plain object
1112
+ for (const key in config) {
1113
+ if (Object.prototype.hasOwnProperty.call(config, key)) {
1114
+ plainConfig[key] = config[key];
1115
+ }
1116
+ }
1117
+ message = Object.assign(Object.assign({}, message), { decoderConfig: plainConfig });
1118
+ }
1119
+ return originalPostMessage(message, transfer);
1120
+ };
1121
+ return worker;
1122
+ };
1123
+ // Copy static properties
1124
+ for (const key in OriginalWorker) {
1125
+ if (Object.prototype.hasOwnProperty.call(OriginalWorker, key)) {
1126
+ window.Worker[key] = OriginalWorker[key];
1127
+ }
1128
+ }
1129
+ }
1091
1130
  this.dracoLoader.preload();
1092
1131
  this.gltfLoader.setDRACOLoader(this.dracoLoader);
1093
1132
  }
@@ -2472,7 +2511,7 @@ class Controller {
2472
2511
  this.fireComponentClick(component, hit, isDoubleClick);
2473
2512
  // Actor level
2474
2513
  const actor = component.parentActor;
2475
- //console.log("[Controller]fireClickEvents", actor, actor?.isClickEnabled)
2514
+ console.log("[Controller]fireClickEvents", actor, actor === null || actor === void 0 ? void 0 : actor.isClickEnabled);
2476
2515
  if (actor && actor.isClickEnabled) {
2477
2516
  this.fireActorClick(actor, component, hit, isDoubleClick);
2478
2517
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lythreeframe",
3
- "version": "1.2.67",
3
+ "version": "1.2.68",
4
4
  "description": "Three.js 封装",
5
5
  "main": "dist/bundle.cjs.js",
6
6
  "module": "dist/bundle.esm.js",