Don't allow skinny images in meme-gen

This commit is contained in:
Daniel Odendahl Jr
2019-02-13 14:37:37 +00:00
parent bad0a70d1b
commit 6b80c97076
4 changed files with 5 additions and 1 deletions
+1
View File
@@ -99,6 +99,7 @@ module.exports = class CanvasUtil {
static wrapText(ctx, text, maxWidth) {
return new Promise(resolve => {
if (ctx.measureText(text).width < maxWidth) return resolve([text]);
if (ctx.measureText('W').width > maxWidth) return resolve(null);
const words = text.split(' ');
const lines = [];
let line = '';