@@ -45,7 +45,7 @@ export class AssetsGenerationService implements IAssetsGenerationService {
4545 )
4646 . map ( ( assetGroup : IAssetGroup ) =>
4747 _ . filter ( assetGroup , ( assetSubGroup : IAssetSubGroup , imageTypeKey : string ) =>
48- assetSubGroup && propertiesToEnumerate . indexOf ( imageTypeKey ) !== - 1 && assetSubGroup [ imageTypeKey ]
48+ assetSubGroup && propertiesToEnumerate . indexOf ( imageTypeKey ) !== - 1
4949 )
5050 )
5151 . flatten < IAssetSubGroup > ( )
@@ -57,26 +57,33 @@ export class AssetsGenerationService implements IAssetsGenerationService {
5757 for ( const assetItem of assetItems ) {
5858 const operation = assetItem . resizeOperation || Operations . Resize ;
5959 let tempScale : number = null ;
60- if ( assetItem . scale && ! _ . isNumber ( assetItem . scale ) ) {
61- const splittedElements = `${ assetItem . scale } ` . split ( AssetConstants . sizeDelimiter ) ;
62- tempScale = splittedElements && splittedElements . length && splittedElements [ 0 ] && + splittedElements [ 0 ] ;
60+ if ( assetItem . scale ) {
61+ if ( _ . isNumber ( assetItem . scale ) ) {
62+ tempScale = assetItem . scale ;
63+ } else {
64+ const splittedElements = `${ assetItem . scale } ` . split ( AssetConstants . sizeDelimiter ) ;
65+ tempScale = splittedElements && splittedElements . length && splittedElements [ 0 ] && + splittedElements [ 0 ] ;
66+ }
6367 }
6468
65- const scale = tempScale || 0.8 ;
69+ const scale = tempScale || 1 ;
6670
6771 const outputPath = assetItem . path ;
72+ const width = assetItem . width * scale ;
73+ const height = assetItem . height * scale ;
6874
6975 switch ( operation ) {
7076 case Operations . OverlayWith :
71- const imageResize = Math . round ( Math . min ( assetItem . width , assetItem . height ) * scale ) ;
77+ const overlayImageScale = assetItem . overlayImageScale || 0.8 ;
78+ const imageResize = Math . round ( Math . min ( width , height ) * overlayImageScale ) ;
7279 const image = await this . resize ( generationData . imagePath , imageResize , imageResize ) ;
73- await this . generateImage ( generationData . background , assetItem . width , assetItem . height , outputPath , image ) ;
80+ await this . generateImage ( generationData . background , width , height , outputPath , image ) ;
7481 break ;
7582 case Operations . Blank :
76- await this . generateImage ( generationData . background , assetItem . width , assetItem . height , outputPath ) ;
83+ await this . generateImage ( generationData . background , width , height , outputPath ) ;
7784 break ;
7885 case Operations . Resize :
79- const resizedImage = await this . resize ( generationData . imagePath , assetItem . width , assetItem . height ) ;
86+ const resizedImage = await this . resize ( generationData . imagePath , width , height ) ;
8087 resizedImage . write ( outputPath ) ;
8188 break ;
8289 default :
0 commit comments