From 61abce80fb80f87f860f45ca15596cccce56983e Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sun, 28 Apr 2024 15:04:45 -0400 Subject: [PATCH] Do the same for the labal --- commands/edit-image-text/tweet.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/commands/edit-image-text/tweet.js b/commands/edit-image-text/tweet.js index a4859bb0..e649d6b3 100644 --- a/commands/edit-image-text/tweet.js +++ b/commands/edit-image-text/tweet.js @@ -122,7 +122,17 @@ module.exports = class TweetCommand extends Command { if (userData.label) { const labelData = await request.get(userData.label); const labelImg = await loadImage(labelData.body); - ctx.drawImage(labelImg, 80 + nameLen + 3 + 20 + 3, 90, 20, 20); + const labelCanvas = createCanvas(20, 20); + const labelCtx = labelCanvas.getContext('2d'); + this.roundedPath(labelCtx, 15, 0, 0, 20, 20); + labelCtx.clip(); + labelCtx.drawImage(labelImg, 0, 0, 20, 20); + this.roundedPath(labelCtx, 15, 0, 0, 20, 20); + labelCtx.clip(); + labelCtx.strokeStyle = '#303336'; + labelCtx.lineWidth = 5; + labelCtx.stroke(); + ctx.drawImage(labelCanvas, 80 + nameLen + 3 + 20 + 3, 90, 20, 20); } ctx.font = this.client.fonts.get('ChirpRegular.ttf').toCanvasString(17); ctx.fillStyle = '#71767b';