File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -177,18 +177,13 @@ const addAttributes = (_element) => {
177177} ;
178178
179179const loadLayerImg = async ( _layer ) => {
180- try {
181- if ( _layer . selectedElement . path . includes ( "-" ) ) {
182- throw new Error ( "layer name can not contain dashes" ) ;
183- }
184- const image = await loadImage ( `${ _imgObject . path } ` ) ;
185- return {
186- imgObject : _imgObject ,
187- loadedImage : image ,
188- } ;
189- } catch ( error ) {
190- console . error ( "Error loading image:" , error ) ;
180+ if ( _layer . selectedElement . path . includes ( "-" ) ) {
181+ throw new Error ( "layer name can not contain dashes" ) ;
191182 }
183+ return new Promise ( async ( resolve ) => {
184+ const image = await loadImage ( `${ _layer . selectedElement . path } ` ) ;
185+ resolve ( { layer : _layer , loadedImage : image } ) ;
186+ } ) ;
192187} ;
193188
194189const addText = ( _sig , x , y , size ) => {
Original file line number Diff line number Diff line change @@ -38,10 +38,15 @@ const getImages = (_dir) => {
3838} ;
3939
4040const loadImgData = async ( _imgObject ) => {
41- return new Promise ( async ( resolve ) => {
41+ try {
4242 const image = await loadImage ( `${ _imgObject . path } ` ) ;
43- resolve ( { imgObject : _imgObject , loadedImage : image } ) ;
44- } ) ;
43+ return {
44+ imgObject : _imgObject ,
45+ loadedImage : image ,
46+ } ;
47+ } catch ( error ) {
48+ console . error ( "Error loading image:" , error ) ;
49+ }
4550} ;
4651
4752const draw = ( _imgObject ) => {
You can’t perform that action at this time.
0 commit comments