lythreeframe 1.2.65 → 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.
package/dist/bundle.cjs.js
CHANGED
|
@@ -1087,9 +1087,48 @@ class AssetManager {
|
|
|
1087
1087
|
}
|
|
1088
1088
|
setupDracoLoader(dracoPath) {
|
|
1089
1089
|
if (!this.dracoLoader) {
|
|
1090
|
-
|
|
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
|
-
|
|
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
|
}
|
|
@@ -1391,6 +1430,24 @@ class World {
|
|
|
1391
1430
|
actor.onAddedToWorld(this);
|
|
1392
1431
|
this.viewport.markRenderStateDirty();
|
|
1393
1432
|
}
|
|
1433
|
+
removeActor(actor) {
|
|
1434
|
+
actor.destroy();
|
|
1435
|
+
this.actors.delete(actor);
|
|
1436
|
+
this.viewport.markRenderStateDirty();
|
|
1437
|
+
}
|
|
1438
|
+
removeActors(actors) {
|
|
1439
|
+
for (const actor of actors) {
|
|
1440
|
+
actor.destroy();
|
|
1441
|
+
this.actors.delete(actor);
|
|
1442
|
+
}
|
|
1443
|
+
this.viewport.markRenderStateDirty();
|
|
1444
|
+
}
|
|
1445
|
+
getActorById(id) {
|
|
1446
|
+
return this.rootActor.getChildActorById(id, true);
|
|
1447
|
+
}
|
|
1448
|
+
getActorsByIds(ids) {
|
|
1449
|
+
return this.rootActor.getChildActorsByIds(ids, true);
|
|
1450
|
+
}
|
|
1394
1451
|
}
|
|
1395
1452
|
|
|
1396
1453
|
class WebGPUPostProcessFactory {
|
|
@@ -2456,6 +2513,7 @@ class Controller {
|
|
|
2456
2513
|
this.fireComponentClick(component, hit, isDoubleClick);
|
|
2457
2514
|
// Actor level
|
|
2458
2515
|
const actor = component.parentActor;
|
|
2516
|
+
console.log("[Controller]fireClickEvents", actor, actor === null || actor === void 0 ? void 0 : actor.isClickEnabled);
|
|
2459
2517
|
if (actor && actor.isClickEnabled) {
|
|
2460
2518
|
this.fireActorClick(actor, component, hit, isDoubleClick);
|
|
2461
2519
|
}
|
|
@@ -2491,7 +2549,13 @@ class Controller {
|
|
|
2491
2549
|
this.raycaster.setFromCamera(this._raycastVec2, this.camera);
|
|
2492
2550
|
const out = this.getAllHitResultFromScreenPoint(x, y);
|
|
2493
2551
|
for (const hit of out) {
|
|
2494
|
-
|
|
2552
|
+
// 检查 Component 级别的交互状态
|
|
2553
|
+
const componentInteractable = hit.component.isHoverEnabled || hit.component.isClickEnabled;
|
|
2554
|
+
// 检查 Actor 级别的交互状态
|
|
2555
|
+
const actor = hit.component.parentActor;
|
|
2556
|
+
const actorInteractable = actor && (actor.isHoverEnabled || actor.isClickEnabled);
|
|
2557
|
+
// 只要 Component 或 Actor 任一可交互,就返回该结果
|
|
2558
|
+
if (!componentInteractable && !actorInteractable)
|
|
2495
2559
|
continue;
|
|
2496
2560
|
return hit;
|
|
2497
2561
|
}
|
|
@@ -2750,6 +2814,29 @@ class Actor extends BaseObject {
|
|
|
2750
2814
|
}
|
|
2751
2815
|
return null;
|
|
2752
2816
|
}
|
|
2817
|
+
getChildActorsByIds(ids, bRecursive = true) {
|
|
2818
|
+
const result = [];
|
|
2819
|
+
const idSet = new Set(ids);
|
|
2820
|
+
const directChildren = this.childActors;
|
|
2821
|
+
for (const child of directChildren) {
|
|
2822
|
+
if (idSet.has(child.uuid)) {
|
|
2823
|
+
result.push(child);
|
|
2824
|
+
idSet.delete(child.uuid);
|
|
2825
|
+
}
|
|
2826
|
+
}
|
|
2827
|
+
if (bRecursive && idSet.size > 0) {
|
|
2828
|
+
for (const child of directChildren) {
|
|
2829
|
+
const foundInChildren = child.getChildActorsByIds([...idSet], true);
|
|
2830
|
+
for (const found of foundInChildren) {
|
|
2831
|
+
result.push(found);
|
|
2832
|
+
idSet.delete(found.uuid);
|
|
2833
|
+
}
|
|
2834
|
+
if (idSet.size === 0)
|
|
2835
|
+
break;
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
return result;
|
|
2839
|
+
}
|
|
2753
2840
|
getComponentById(id) {
|
|
2754
2841
|
return this.rootComponent.getComponentById(id);
|
|
2755
2842
|
}
|
package/dist/bundle.esm.js
CHANGED
|
@@ -1085,9 +1085,48 @@ class AssetManager {
|
|
|
1085
1085
|
}
|
|
1086
1086
|
setupDracoLoader(dracoPath) {
|
|
1087
1087
|
if (!this.dracoLoader) {
|
|
1088
|
-
|
|
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
|
-
|
|
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
|
}
|
|
@@ -1389,6 +1428,24 @@ class World {
|
|
|
1389
1428
|
actor.onAddedToWorld(this);
|
|
1390
1429
|
this.viewport.markRenderStateDirty();
|
|
1391
1430
|
}
|
|
1431
|
+
removeActor(actor) {
|
|
1432
|
+
actor.destroy();
|
|
1433
|
+
this.actors.delete(actor);
|
|
1434
|
+
this.viewport.markRenderStateDirty();
|
|
1435
|
+
}
|
|
1436
|
+
removeActors(actors) {
|
|
1437
|
+
for (const actor of actors) {
|
|
1438
|
+
actor.destroy();
|
|
1439
|
+
this.actors.delete(actor);
|
|
1440
|
+
}
|
|
1441
|
+
this.viewport.markRenderStateDirty();
|
|
1442
|
+
}
|
|
1443
|
+
getActorById(id) {
|
|
1444
|
+
return this.rootActor.getChildActorById(id, true);
|
|
1445
|
+
}
|
|
1446
|
+
getActorsByIds(ids) {
|
|
1447
|
+
return this.rootActor.getChildActorsByIds(ids, true);
|
|
1448
|
+
}
|
|
1392
1449
|
}
|
|
1393
1450
|
|
|
1394
1451
|
class WebGPUPostProcessFactory {
|
|
@@ -2454,6 +2511,7 @@ class Controller {
|
|
|
2454
2511
|
this.fireComponentClick(component, hit, isDoubleClick);
|
|
2455
2512
|
// Actor level
|
|
2456
2513
|
const actor = component.parentActor;
|
|
2514
|
+
console.log("[Controller]fireClickEvents", actor, actor === null || actor === void 0 ? void 0 : actor.isClickEnabled);
|
|
2457
2515
|
if (actor && actor.isClickEnabled) {
|
|
2458
2516
|
this.fireActorClick(actor, component, hit, isDoubleClick);
|
|
2459
2517
|
}
|
|
@@ -2489,7 +2547,13 @@ class Controller {
|
|
|
2489
2547
|
this.raycaster.setFromCamera(this._raycastVec2, this.camera);
|
|
2490
2548
|
const out = this.getAllHitResultFromScreenPoint(x, y);
|
|
2491
2549
|
for (const hit of out) {
|
|
2492
|
-
|
|
2550
|
+
// 检查 Component 级别的交互状态
|
|
2551
|
+
const componentInteractable = hit.component.isHoverEnabled || hit.component.isClickEnabled;
|
|
2552
|
+
// 检查 Actor 级别的交互状态
|
|
2553
|
+
const actor = hit.component.parentActor;
|
|
2554
|
+
const actorInteractable = actor && (actor.isHoverEnabled || actor.isClickEnabled);
|
|
2555
|
+
// 只要 Component 或 Actor 任一可交互,就返回该结果
|
|
2556
|
+
if (!componentInteractable && !actorInteractable)
|
|
2493
2557
|
continue;
|
|
2494
2558
|
return hit;
|
|
2495
2559
|
}
|
|
@@ -2748,6 +2812,29 @@ class Actor extends BaseObject {
|
|
|
2748
2812
|
}
|
|
2749
2813
|
return null;
|
|
2750
2814
|
}
|
|
2815
|
+
getChildActorsByIds(ids, bRecursive = true) {
|
|
2816
|
+
const result = [];
|
|
2817
|
+
const idSet = new Set(ids);
|
|
2818
|
+
const directChildren = this.childActors;
|
|
2819
|
+
for (const child of directChildren) {
|
|
2820
|
+
if (idSet.has(child.uuid)) {
|
|
2821
|
+
result.push(child);
|
|
2822
|
+
idSet.delete(child.uuid);
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
if (bRecursive && idSet.size > 0) {
|
|
2826
|
+
for (const child of directChildren) {
|
|
2827
|
+
const foundInChildren = child.getChildActorsByIds([...idSet], true);
|
|
2828
|
+
for (const found of foundInChildren) {
|
|
2829
|
+
result.push(found);
|
|
2830
|
+
idSet.delete(found.uuid);
|
|
2831
|
+
}
|
|
2832
|
+
if (idSet.size === 0)
|
|
2833
|
+
break;
|
|
2834
|
+
}
|
|
2835
|
+
}
|
|
2836
|
+
return result;
|
|
2837
|
+
}
|
|
2751
2838
|
getComponentById(id) {
|
|
2752
2839
|
return this.rootComponent.getComponentById(id);
|
|
2753
2840
|
}
|
|
@@ -22,4 +22,8 @@ export declare class World {
|
|
|
22
22
|
tick(deltaTime: number): void;
|
|
23
23
|
destroy(): void;
|
|
24
24
|
addActor(actor: Actor): void;
|
|
25
|
+
removeActor(actor: Actor): void;
|
|
26
|
+
removeActors(actors: Actor[]): void;
|
|
27
|
+
getActorById(id: string): Actor | null;
|
|
28
|
+
getActorsByIds(ids: string[]): Actor[];
|
|
25
29
|
}
|
|
@@ -33,6 +33,7 @@ export declare class Actor extends BaseObject {
|
|
|
33
33
|
protected constructRootComponent(): SceneComponent;
|
|
34
34
|
getBoundsCenterPosition(bInWorldSpace?: boolean): Vector3;
|
|
35
35
|
getChildActorById(id: string, bRecursive?: boolean): Actor | null;
|
|
36
|
+
getChildActorsByIds(ids: string[], bRecursive?: boolean): Actor[];
|
|
36
37
|
getComponentById(id: string): SceneComponent | null;
|
|
37
38
|
getBoundsTopCenterPosition(bInWorldSpace?: boolean): Vector3;
|
|
38
39
|
getBoundsBottomCenterPosition(bInWorldSpace?: boolean): Vector3;
|