resize better

This commit is contained in:
loicbersier 2018-10-14 17:38:37 +02:00
parent 2d2e47a578
commit c38c98e160

View file

@ -41,7 +41,7 @@ module.exports = class idubbbzCommand extends Command {
do { do {
// Assign the font to the context and decrement it so it can be measured again // Assign the font to the context and decrement it so it can be measured again
ctx.font = `${fontSize -= 10}px sans-serif`; ctx.font = `${fontSize -= 10}px sans-serif`;
} while (ctx.measureText(text).width > 950 - 300); } while (ctx.measureText(text).width > 700 - 300);
// Return the result to use in the actual canvas // Return the result to use in the actual canvas
return ctx.font; return ctx.font;