Skip to content

Commit e5b8658

Browse files
committed
Remove special class just for zip load error dialog
1 parent a0bf950 commit e5b8658

File tree

4 files changed

+22
-31
lines changed

4 files changed

+22
-31
lines changed

src/lib/Generators.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ export class Generators {
1818
return material
1919
}
2020

21+
// put HTML with all the contributors
22+
static get_contributors_list (): string {
23+
// Return a list of contributors
24+
return `
25+
<div style="text-align: start">
26+
<p><span style="font-size: 120%">Scott Petrovic</span> - Project Maintainer</p>
27+
<p><span style="font-size: 120%">Quatnerius</span> - Human model, rig, and animations</p>
28+
</div>
29+
`
30+
}
31+
2132
static create_grid_helper (grid_color: number = 0x111155, floor_color: number = 0x4e4e7a): any[] {
2233
// create floor mesh and add to scene to help with shadows
2334
const grid_size: number = 180

src/lib/processes/load-model/StepLoadModel.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { ZipLoadErrorDialog } from './ZipLoadErrorDialog.ts'
21
import { UI } from '../../UI.ts'
32
import { ZipGLTFLoader } from './ZipGLTFLoader.ts'
43
import { Box3 } from 'three/src/math/Box3.js'
@@ -11,6 +10,7 @@ import { MeshNormalMaterial } from 'three/src/materials/MeshNormalMaterial.js'
1110
import { MathUtils } from 'three/src/math/MathUtils.js'
1211
import { FrontSide } from 'three/src/constants.js'
1312
import { type BufferGeometry, type Material, type Object3D, type SkinnedMesh } from 'three'
13+
import { ModalDialog } from '../../ModalDialog.ts'
1414

1515
// Note: EventTarget is a built-ininterface and do not need to import it
1616
export class StepLoadModel extends EventTarget {
@@ -178,12 +178,12 @@ export class StepLoadModel extends EventTarget {
178178
const zip_loader = new ZipGLTFLoader(this.gltf_loader)
179179
zip_loader.load_from_zip(buffer, (scene) => {
180180
this.process_loaded_scene(scene) // loaded successfully...continue
181-
}, (err) => {
181+
}, (err: Error) => {
182182
console.error('Failed to load GLTF from ZIP:', err)
183-
new ZipLoadErrorDialog('Failed to load GLTF from ZIP: ' + (err?.message || err))
184-
}).catch((err) => {
183+
new ModalDialog('Failed to load GLTF from ZIP: ', err?.message || err).show()
184+
}).catch((err: Error) => {
185185
console.error('Error loading ZIP:', err)
186-
new ZipLoadErrorDialog('Error loading ZIP: ' + (err?.message || err))
186+
new ModalDialog('Error loading ZIP: ', err?.message || err).show()
187187
})
188188
}
189189

@@ -192,16 +192,16 @@ export class StepLoadModel extends EventTarget {
192192
fetch(model_file_path)
193193
.then(async res => await res.arrayBuffer())
194194
.then(buffer => { handle_zip(buffer) })
195-
.catch(err => {
195+
.catch((err: Error) => {
196196
console.error('Failed to fetch ZIP data:', err)
197-
new ZipLoadErrorDialog('Failed to fetch ZIP data: ' + (err?.message || err))
197+
new ModalDialog('Failed to fetch ZIP data: ', err?.message || err).show()
198198
})
199199
} else if (model_file_path instanceof ArrayBuffer) {
200200
handle_zip(model_file_path)
201201
} else {
202-
const msg = 'ZIP file data is not in a supported format';
202+
const msg = 'ZIP file data is not in a supported format'
203203
console.error(msg)
204-
new ZipLoadErrorDialog(msg)
204+
new ModalDialog('ZIP file error decompressing: ', msg).show()
205205
}
206206
}
207207

src/lib/processes/load-model/ZipLoadErrorDialog.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/script.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -518,18 +518,11 @@ export class Bootstrap {
518518
// Show the contributors dialog
519519
console.log('Showing contributors dialog')
520520
// instantiate modal dialog and show contributors
521-
const modal = new ModalDialog('Contributors', this.get_contributors_list())
521+
const modal = new ModalDialog('Contributors', Generators.get_contributors_list())
522522
modal.show()
523523
}
524524

525-
private get_contributors_list (): string {
526-
// Return a list of contributors
527-
return `
528-
<p>Contributor 1</p>
529-
<p>Contributor 2</p>
530-
<p>Contributor 3</p>
531-
`
532-
}
525+
533526
} // end Bootstrap class
534527

535528
// Create an instance of the Bootstrap class when the script is loaded

0 commit comments

Comments
 (0)