Skip to content

Commit

Permalink
Fix for some compilation issues
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwardMoyse committed May 3, 2024
1 parent 6effabb commit f7fc41f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
6 changes: 3 additions & 3 deletions packages/phoenix-event-display/src/event-display.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,16 +333,16 @@ export class EventDisplay {
* @returns Promise for loading the geometry.
*/
public async parseGLTFGeometry(file: File): Promise<void> {
name = file.name.split('/').pop();
this.loadingManager.addLoadableItem(`parse_gltf_${name}`);
const filename = file.name.split('/').pop();
this.loadingManager.addLoadableItem(`parse_gltf_${filename}`);

const allGeometriesUIParameters =
await this.graphicsLibrary.parseGLTFGeometry(file);
for (const { object, menuNodeName } of allGeometriesUIParameters) {
this.ui.addGeometry(object, menuNodeName);
}

this.loadingManager.itemLoaded(`parse_gltf_${name}`);
this.loadingManager.itemLoaded(`parse_gltf_${filename}`);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ export class ImportManager {
callback: (
fileContent: ArrayBuffer,
path: string,
name: string
) => Promise<GeometryUIParameters[]>
name: string,
) => Promise<GeometryUIParameters[]>,
): Promise<GeometryUIParameters[]> {
if (typeof file != 'string') {
file = file.name;
Expand All @@ -235,15 +235,15 @@ export class ImportManager {
if (file.split('.').pop() == 'zip') {
try {
JSZip.loadAsync(data).then((archive) => {
const promises: Promise[] = [];
const promises: Promise<GeometryUIParameters[]>[] = [];
for (const filePath in archive.files) {
promises.push(
archive
.file(filePath)
.async('arraybuffer')
.then((fileData) => {
return callback(fileData, path, filePath.split('.')[0]);
})
}),
);
}
let allGeometriesUIParameters: GeometryUIParameters[] = [];
Expand All @@ -256,9 +256,9 @@ export class ImportManager {
});
});
} catch (error) {
this.eventDisplay
.getInfoLogger()
.add('Could not read zip file', 'Error');
// this.eventDisplay
// .getInfoLogger()
// .add('Could not read zip file', 'Error');
reject(error);
}
} else {
Expand All @@ -268,7 +268,7 @@ export class ImportManager {
},
(error) => {
reject(error);
}
},
);
}
});
Expand Down Expand Up @@ -302,9 +302,9 @@ export class ImportManager {
name,
menuNodeName,
scale,
initiallyVisible
initiallyVisible,
);
}
},
);
}

Expand All @@ -324,7 +324,7 @@ export class ImportManager {
name: string,
menuNodeName: string,
scale: number,
initiallyVisible: boolean
initiallyVisible: boolean,
): Promise<GeometryUIParameters[]> {
const loader = new GLTFLoader();
const dracoLoader = new DRACOLoader();
Expand Down Expand Up @@ -410,8 +410,11 @@ export class ImportManager {
* @param fileName of the geometry file (.gltf,.glb or a zip with such file(s))
* @returns Promise for loading the geometry.
*/
private parseGLTFGeometry(fileName: string): Promise<GeometryUIParameters[]> {
return this.zipHandlingWrapper(fileName, parseGLTFGeometryFromArrayBuffer);
public parseGLTFGeometry(fileName: string): Promise<GeometryUIParameters[]> {
return this.zipHandlingWrapper(
fileName,
this.parseGLTFGeometryFromArrayBuffer,
);
}

/** Parses and loads a geometry in GLTF (.gltf) format.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ export class ThreeManager {
*/
public async parseGLTFGeometry(file: File): Promise<GeometryUIParameters[]> {
const allGeometriesUIParameters =
await this.importManager.parseGLTFGeometry(file);
await this.importManager.parseGLTFGeometry(file.name);

for (const { object } of allGeometriesUIParameters) {
this.sceneManager.getGeometries().add(object);
Expand Down

0 comments on commit f7fc41f

Please sign in to comment.