Skip to content

Commit 920cb8e

Browse files
chore: fix incorrect assets definitions
1 parent c9d4d8f commit 920cb8e

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

lib/constants.ts

+3
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,7 @@ export class AssetConstants {
162162
public static assets = "assets";
163163

164164
public static sizeDelimiter = "x";
165+
166+
public static defaultScale = 1;
167+
public static defaultOverlayImageScale = 0.8;
165168
}

lib/services/assets-generation/assets-generation-service.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as Jimp from "jimp";
22
import * as Color from "color";
33
import { exported } from "../../common/decorators";
4-
import { AssetConstants } from "../../constants";
4+
import { AssetConstants } from '../../constants';
55

66
export const enum Operations {
77
OverlayWith = "overlayWith",
@@ -66,15 +66,15 @@ export class AssetsGenerationService implements IAssetsGenerationService {
6666
}
6767
}
6868

69-
const scale = tempScale || 1;
69+
const scale = tempScale || AssetConstants.defaultScale;
7070

7171
const outputPath = assetItem.path;
7272
const width = assetItem.width * scale;
7373
const height = assetItem.height * scale;
7474

7575
switch (operation) {
7676
case Operations.OverlayWith:
77-
const overlayImageScale = assetItem.overlayImageScale || 0.8;
77+
const overlayImageScale = assetItem.overlayImageScale || AssetConstants.defaultOverlayImageScale;
7878
const imageResize = Math.round(Math.min(width, height) * overlayImageScale);
7979
const image = await this.resize(generationData.imagePath, imageResize, imageResize);
8080
await this.generateImage(generationData.background, width, height, outputPath, image);

lib/services/project-data-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export class ProjectDataService implements IProjectDataService {
161161

162162
image.resizeOperation = image.resizeOperation || assetItem.resizeOperation;
163163
image.overlayImageScale = image.overlayImageScale || assetItem.overlayImageScale;
164-
164+
image.scale = image.scale || assetItem.scale;
165165
// break each
166166
return false;
167167
}

resources/assets/image-definitions.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"height": 60,
1414
"directory": "Assets.xcassets/AppIcon.appiconset",
1515
"filename": "[email protected]",
16-
"scale": "3x"
16+
"scale": "2x"
1717
},
1818
{
1919
"width": 40,

0 commit comments

Comments
 (0)