File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ export class ConfigClass {
8585
8686 inputElement ! . addEventListener ( "input" , updateDisplayedValue ) ;
8787 }
88-
88+
8989 else if ( type === "image" ) {
9090 const imageFile = await zip . file ( widget_object . file ) ?. async ( "blob" ) ;
9191
@@ -94,8 +94,8 @@ export class ConfigClass {
9494
9595 img . src = URL . createObjectURL ( imageFile ) ;
9696
97- if ( widget_object . width ) img . style = `max-width: ${ typeof widget_object . width === "string" ? widget_object . width : widget_object . width . toString ( ) + "px" } ;` ;
98- else if ( widget_object . height ) img . style = `max-height: ${ typeof widget_object . height === "string" ? widget_object . height : widget_object . height . toString ( ) + "px" } ;` ;
97+ if ( widget_object . width ) img . style = `max-width: ${ parseImageSize ( widget_object . width ) } ;` ;
98+ else if ( widget_object . height ) img . style = `max-height: ${ parseImageSize ( widget_object . height ) } ;` ;
9999 }
100100 }
101101
@@ -210,6 +210,10 @@ export class ConfigClass {
210210
211211}
212212
213+ function parseImageSize ( dimension : string | number ) {
214+ return typeof dimension === "string" ? dimension : dimension . toString ( ) + "px" ;
215+ }
216+
213217function getElementSuffix ( element : NumberWidget | SliderWidget ) {
214218 let suffix = "" ;
215219
You can’t perform that action at this time.
0 commit comments