@@ -75,6 +75,10 @@ export async function prepareGlbPayload(modelName: string): Promise<Payload> {
75
75
return { blob : await getModelViewer ( ) ! . exportScene ( ) , filename : modelName } ;
76
76
}
77
77
78
+ async function preparePosterPayload ( posterName : string ) : Promise < Payload > {
79
+ return { blob : await createPoster ( ) , filename : posterName } ;
80
+ }
81
+
78
82
// Fixes some formatting issues with the snippet as it is being placed into the
79
83
// template.
80
84
function beautify_snippet ( snippetList : string [ ] ) : string {
@@ -188,18 +192,18 @@ async function prepareZipArchive(
188
192
/**
189
193
* A button to download GLB file resources.
190
194
*/
191
- @customElement ( 'me-download -button' )
192
- export class DownloadButton extends GenericDownloadButton {
195
+ @customElement ( 'me-export-poster -button' )
196
+ export class ExportPosterButton extends GenericDownloadButton {
193
197
constructor ( ) {
194
198
super ( ) ;
195
- this . buttonLabel = 'GLB ' ;
199
+ this . buttonLabel = 'POSTER ' ;
196
200
}
197
201
198
202
stateChanged ( state : State ) {
199
203
const loaded = getModelViewer ( ) ?. loaded ;
200
- const modelName = getRelativeFilePaths ( state ) . modelName ! ;
204
+ const { posterName } = getRelativeFilePaths ( state ) ;
201
205
this . preparePayload =
202
- loaded ? ( ) => prepareGlbPayload ( modelName ) : undefined ;
206
+ loaded ? ( ) => preparePosterPayload ( posterName ) : undefined ;
203
207
}
204
208
}
205
209
@@ -237,7 +241,7 @@ export class ExportZipButton extends GenericDownloadButton {
237
241
238
242
declare global {
239
243
interface HTMLElementTagNameMap {
240
- 'me-download- button' : DownloadButton ;
244
+ 'me-export-poster- button' : ExportPosterButton ;
241
245
'me-export-zip-button' : ExportZipButton ;
242
246
}
243
247
}
0 commit comments