Update Tweet Layout

This commit is contained in:
Dragon Fire
2020-11-07 14:38:00 -05:00
parent 512ce651c0
commit fe7c30fab8
2 changed files with 26 additions and 11 deletions
+25 -10
View File
@@ -76,7 +76,8 @@ module.exports = class TweetCommand extends Command {
canvas.height += linesLen;
const likes = Math.floor(Math.random() * 100000) + 1;
const retweets = Math.floor(Math.random() * 100000) + 1;
const replies = Math.floor(Math.random() * 100000) + 1;
const quoteTweets = Math.floor(Math.random() * 100000) + 1;
// const replies = Math.floor(Math.random() * 100000) + 1;
ctx.fillStyle = '#15202b';
ctx.fillRect(0, base1.height, canvas.width, linesLen);
ctx.drawImage(base1, 0, 0);
@@ -108,21 +109,35 @@ module.exports = class TweetCommand extends Command {
ctx.fillText('Twitter for Xiao', 31 + timeLen + 6, base2StartY + 16);
ctx.fillStyle = '#8899a6';
ctx.font = '16px Noto';
ctx.fillText(formatNumberK(replies), 87, base2StartY + 139);
ctx.fillText(formatNumberK(likes), 509, base2StartY + 139);
ctx.fillText(formatNumberK(retweets), 300, base2StartY + 139);
// ctx.fillText(formatNumberK(replies), 87, base2StartY + 139);
// ctx.fillText(formatNumberK(likes), 509, base2StartY + 139);
// ctx.fillText(formatNumberK(retweets), 300, base2StartY + 139);
let currentLen = 31;
ctx.fillStyle = 'white';
ctx.font = 'normal bold 18px Noto';
ctx.fillText(formatNumberK(retweets), 31, base2StartY + 77);
const retweetsLen = ctx.measureText(formatNumberK(retweets)).width;
ctx.fillText(formatNumberK(retweets), currentLen, base2StartY + 77);
currentLen += ctx.measureText(formatNumberK(retweets)).width;
currentLen += 5;
ctx.fillStyle = '#8899a6';
ctx.font = '18px Noto';
ctx.fillText('Retweets', 31 + retweetsLen + 5, base2StartY + 77);
const retweetsWordLen = ctx.measureText('Retweets').width;
ctx.fillText('Retweets', currentLen, base2StartY + 77);
currentLen += ctx.measureText('Retweets').width;
currentLen += 10;
ctx.fillStyle = 'white';
ctx.font = 'normal bold 18px Noto';
ctx.fillText(formatNumberK(likes), 31 + retweetsLen + 5 + retweetsWordLen + 10, base2StartY + 77);
const likesLen = ctx.measureText(formatNumberK(likes)).width;
ctx.fillText(formatNumberK(quoteTweets), currentLen, base2StartY + 77);
currentLen += ctx.measureText(formatNumberK(quoteTweets)).width;
currentLen += 5;
ctx.fillStyle = '#8899a6';
ctx.font = '18px Noto';
ctx.fillText('Quote Tweets', currentLen, base2StartY + 77);
currentLen += ctx.measureText('Quote Tweets').width;
currentLen += 10;
ctx.fillStyle = 'white';
ctx.font = 'normal bold 18px Noto';
ctx.fillText(formatNumberK(likes), currentLen, base2StartY + 77);
currentLen += ctx.measureText(formatNumberK(likes)).width;
currentLen += 5;
ctx.fillStyle = '#8899a6';
ctx.font = '18px Noto';
ctx.fillText('Likes', 31 + retweetsLen + 5 + retweetsWordLen + 10 + likesLen + 5, base2StartY + 77);
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "119.39.1",
"version": "119.39.2",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {