From c70988384e89cbae3499511429b6e736374cbd03 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Fri, 21 Feb 2020 21:09:23 +0100 Subject: [PATCH] Some refraction --- commands/images/meme.js | 2 +- commands/images/poster.js | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/commands/images/meme.js b/commands/images/meme.js index 4e293cd..5528130 100644 --- a/commands/images/meme.js +++ b/commands/images/meme.js @@ -84,7 +84,7 @@ class memeCommand extends Command { // Set text position for top and bottom const TOP_POS = Math.abs((value.height / 2) - PADDING) * -1; const BOTTOM_POS = (value.height / 2) - PADDING; - let FONT_SIZE = args.fontSize == true ? args.fontSize : (value.width / 10); + let FONT_SIZE = args.fontSize ? args.fontSize : (value.width / 10); // Write text on image using graphicsmagick img.font(FONT, FONT_SIZE) diff --git a/commands/images/poster.js b/commands/images/poster.js index aa3bf69..2592873 100644 --- a/commands/images/poster.js +++ b/commands/images/poster.js @@ -103,10 +103,8 @@ class posterCommand extends Command { const TOP_POS = Math.abs((value.height / 2) - PADDING + 110); const BOTTOM_POS = Math.abs((value.height / 2) - PADDING + 180); - let FONT_SIZE1 = (value.width / 12); - if (args.title) FONT_SIZE1 = args.title; - let FONT_SIZE2 = (value.width / 12) - 15; - if (args.subtext) FONT_SIZE2 = args.subtext; + let FONT_SIZE1 = args.title ? args.title : (value.width / 12); + let FONT_SIZE2 = args.subtext ? args.subtext : (value.width / 12) - 15; let BORDER_WIDTH = args.width; let BORDER_HEIGHT = args.height;