lythreeframe 1.2.32 → 1.2.34

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.
@@ -683,6 +683,9 @@ class SceneComponent extends Component {
683
683
  }
684
684
  /* click */
685
685
  onClicked() {
686
+ if (!this.isClickEnabled) {
687
+ return;
688
+ }
686
689
  if (this.parentActor) {
687
690
  let comp = this;
688
691
  this.parentActor.onComponentClicked(comp);
@@ -1115,51 +1118,10 @@ class AssetManager {
1115
1118
  });
1116
1119
  }
1117
1120
  }
1118
- // loadMultiGLTFAsGroup(tasks:LoadTask[], onProgress:((url:string, loaded:number, total:number) => void) | null = null, onAllFinished:(() => void) | null = null)
1119
- // {
1120
- // this.loadingManager.onLoad = onAllFinished ? () =>
1121
- // {
1122
- // this.loadingManager.onLoad = () =>
1123
- // {
1124
- // };
1125
- // onAllFinished();
1126
- // } : () =>
1127
- // {
1128
- // this.loadingManager.onLoad = () =>
1129
- // {
1130
- // };
1131
- // };
1132
- // this.loadingManager.onProgress = onProgress ? (url, loaded, total) =>
1133
- // {
1134
- // onProgress(url, loaded, total);
1135
- // } : () =>
1136
- // {
1137
- // };
1138
- // tasks.forEach(
1139
- // (task) =>
1140
- // {
1141
- // task.Paths.forEach(
1142
- // (path) =>
1143
- // {
1144
- // const onGlbLoaded = (glb:GLTF) =>
1145
- // {
1146
- // task.onLoadingFinished(glb);
1147
- // this.collectResourcesAndReferences(glb.scene);
1148
- // };
1149
- // try
1150
- // {
1151
- // this.gltfLoader.load(path, (glb:GLTF) =>
1152
- // {
1153
- // onGlbLoaded(glb);
1154
- // });
1155
- // } catch (e)
1156
- // {
1157
- // console.error(e, path);
1158
- // }
1159
- // });
1160
- // }
1161
- // );
1162
- // }
1121
+ async loadGltfFromPath(path) {
1122
+ let res = await this.gltfLoader.loadAsync(path);
1123
+ return res;
1124
+ }
1163
1125
  loadGltfFromBuffer(data, path, onLoadFinished) {
1164
1126
  this.gltfLoader.parse(data, path, onLoadFinished);
1165
1127
  }
@@ -2255,6 +2217,13 @@ class Controller {
2255
2217
  if (out[i].object.userData["rayIgnored"]) {
2256
2218
  continue;
2257
2219
  }
2220
+ let component = out[i].object.userData["LYObject"];
2221
+ if (!component) {
2222
+ continue;
2223
+ }
2224
+ if (!component.isHoverEnabled && !component.isClickEnabled) {
2225
+ continue;
2226
+ }
2258
2227
  return out[i];
2259
2228
  }
2260
2229
  return null;
@@ -681,6 +681,9 @@ class SceneComponent extends Component {
681
681
  }
682
682
  /* click */
683
683
  onClicked() {
684
+ if (!this.isClickEnabled) {
685
+ return;
686
+ }
684
687
  if (this.parentActor) {
685
688
  let comp = this;
686
689
  this.parentActor.onComponentClicked(comp);
@@ -1113,51 +1116,10 @@ class AssetManager {
1113
1116
  });
1114
1117
  }
1115
1118
  }
1116
- // loadMultiGLTFAsGroup(tasks:LoadTask[], onProgress:((url:string, loaded:number, total:number) => void) | null = null, onAllFinished:(() => void) | null = null)
1117
- // {
1118
- // this.loadingManager.onLoad = onAllFinished ? () =>
1119
- // {
1120
- // this.loadingManager.onLoad = () =>
1121
- // {
1122
- // };
1123
- // onAllFinished();
1124
- // } : () =>
1125
- // {
1126
- // this.loadingManager.onLoad = () =>
1127
- // {
1128
- // };
1129
- // };
1130
- // this.loadingManager.onProgress = onProgress ? (url, loaded, total) =>
1131
- // {
1132
- // onProgress(url, loaded, total);
1133
- // } : () =>
1134
- // {
1135
- // };
1136
- // tasks.forEach(
1137
- // (task) =>
1138
- // {
1139
- // task.Paths.forEach(
1140
- // (path) =>
1141
- // {
1142
- // const onGlbLoaded = (glb:GLTF) =>
1143
- // {
1144
- // task.onLoadingFinished(glb);
1145
- // this.collectResourcesAndReferences(glb.scene);
1146
- // };
1147
- // try
1148
- // {
1149
- // this.gltfLoader.load(path, (glb:GLTF) =>
1150
- // {
1151
- // onGlbLoaded(glb);
1152
- // });
1153
- // } catch (e)
1154
- // {
1155
- // console.error(e, path);
1156
- // }
1157
- // });
1158
- // }
1159
- // );
1160
- // }
1119
+ async loadGltfFromPath(path) {
1120
+ let res = await this.gltfLoader.loadAsync(path);
1121
+ return res;
1122
+ }
1161
1123
  loadGltfFromBuffer(data, path, onLoadFinished) {
1162
1124
  this.gltfLoader.parse(data, path, onLoadFinished);
1163
1125
  }
@@ -2253,6 +2215,13 @@ class Controller {
2253
2215
  if (out[i].object.userData["rayIgnored"]) {
2254
2216
  continue;
2255
2217
  }
2218
+ let component = out[i].object.userData["LYObject"];
2219
+ if (!component) {
2220
+ continue;
2221
+ }
2222
+ if (!component.isHoverEnabled && !component.isClickEnabled) {
2223
+ continue;
2224
+ }
2256
2225
  return out[i];
2257
2226
  }
2258
2227
  return null;
@@ -22,6 +22,7 @@ export declare class AssetManager {
22
22
  convertThreeObjectToLYObject(parentLYComponent: SceneComponent, threejsObject: any): SceneComponent | null;
23
23
  collectResourcesAndReferences(object: Object3D): void;
24
24
  checkMeshResource(mesh: Mesh): void;
25
+ loadGltfFromPath(path: string): Promise<GLTF>;
25
26
  loadGltfFromBuffer(data: ArrayBuffer | string, path: string, onLoadFinished: (gltf: GLTF) => void): void;
26
27
  loadFile(filepath: string | undefined, onLoadFinished: (data: any) => void): void;
27
28
  addAsset(asset: BufferGeometry | Material | Texture, referenceCount?: number): TAssetPointer<BufferGeometry | Material | Texture> | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lythreeframe",
3
- "version": "1.2.32",
3
+ "version": "1.2.34",
4
4
  "description": "Three.js 封装",
5
5
  "main": "dist/bundle.cjs.js",
6
6
  "module": "dist/bundle.esm.js",