1
- import { ZipLoadErrorDialog } from './ZipLoadErrorDialog.ts'
2
1
import { UI } from '../../UI.ts'
3
2
import { ZipGLTFLoader } from './ZipGLTFLoader.ts'
4
3
import { Box3 } from 'three/src/math/Box3.js'
@@ -11,6 +10,7 @@ import { MeshNormalMaterial } from 'three/src/materials/MeshNormalMaterial.js'
11
10
import { MathUtils } from 'three/src/math/MathUtils.js'
12
11
import { FrontSide } from 'three/src/constants.js'
13
12
import { type BufferGeometry , type Material , type Object3D , type SkinnedMesh } from 'three'
13
+ import { ModalDialog } from '../../ModalDialog.ts'
14
14
15
15
// Note: EventTarget is a built-ininterface and do not need to import it
16
16
export class StepLoadModel extends EventTarget {
@@ -178,12 +178,12 @@ export class StepLoadModel extends EventTarget {
178
178
const zip_loader = new ZipGLTFLoader ( this . gltf_loader )
179
179
zip_loader . load_from_zip ( buffer , ( scene ) => {
180
180
this . process_loaded_scene ( scene ) // loaded successfully...continue
181
- } , ( err ) => {
181
+ } , ( err : Error ) => {
182
182
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 ) => {
185
185
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 ( )
187
187
} )
188
188
}
189
189
@@ -192,16 +192,16 @@ export class StepLoadModel extends EventTarget {
192
192
fetch ( model_file_path )
193
193
. then ( async res => await res . arrayBuffer ( ) )
194
194
. then ( buffer => { handle_zip ( buffer ) } )
195
- . catch ( err => {
195
+ . catch ( ( err : Error ) => {
196
196
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 ( )
198
198
} )
199
199
} else if ( model_file_path instanceof ArrayBuffer ) {
200
200
handle_zip ( model_file_path )
201
201
} 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'
203
203
console . error ( msg )
204
- new ZipLoadErrorDialog ( msg )
204
+ new ModalDialog ( 'ZIP file error decompressing: ' , msg ) . show ( )
205
205
}
206
206
}
207
207
0 commit comments