mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-23 18:05:01 +02:00
Update Tweet Layout
This commit is contained in:
@@ -76,7 +76,8 @@ module.exports = class TweetCommand extends Command {
|
|||||||
canvas.height += linesLen;
|
canvas.height += linesLen;
|
||||||
const likes = Math.floor(Math.random() * 100000) + 1;
|
const likes = Math.floor(Math.random() * 100000) + 1;
|
||||||
const retweets = 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.fillStyle = '#15202b';
|
||||||
ctx.fillRect(0, base1.height, canvas.width, linesLen);
|
ctx.fillRect(0, base1.height, canvas.width, linesLen);
|
||||||
ctx.drawImage(base1, 0, 0);
|
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.fillText('Twitter for Xiao', 31 + timeLen + 6, base2StartY + 16);
|
||||||
ctx.fillStyle = '#8899a6';
|
ctx.fillStyle = '#8899a6';
|
||||||
ctx.font = '16px Noto';
|
ctx.font = '16px Noto';
|
||||||
ctx.fillText(formatNumberK(replies), 87, base2StartY + 139);
|
// ctx.fillText(formatNumberK(replies), 87, base2StartY + 139);
|
||||||
ctx.fillText(formatNumberK(likes), 509, base2StartY + 139);
|
// ctx.fillText(formatNumberK(likes), 509, base2StartY + 139);
|
||||||
ctx.fillText(formatNumberK(retweets), 300, base2StartY + 139);
|
// ctx.fillText(formatNumberK(retweets), 300, base2StartY + 139);
|
||||||
|
let currentLen = 31;
|
||||||
ctx.fillStyle = 'white';
|
ctx.fillStyle = 'white';
|
||||||
ctx.font = 'normal bold 18px Noto';
|
ctx.font = 'normal bold 18px Noto';
|
||||||
ctx.fillText(formatNumberK(retweets), 31, base2StartY + 77);
|
ctx.fillText(formatNumberK(retweets), currentLen, base2StartY + 77);
|
||||||
const retweetsLen = ctx.measureText(formatNumberK(retweets)).width;
|
currentLen += ctx.measureText(formatNumberK(retweets)).width;
|
||||||
|
currentLen += 5;
|
||||||
ctx.fillStyle = '#8899a6';
|
ctx.fillStyle = '#8899a6';
|
||||||
ctx.font = '18px Noto';
|
ctx.font = '18px Noto';
|
||||||
ctx.fillText('Retweets', 31 + retweetsLen + 5, base2StartY + 77);
|
ctx.fillText('Retweets', currentLen, base2StartY + 77);
|
||||||
const retweetsWordLen = ctx.measureText('Retweets').width;
|
currentLen += ctx.measureText('Retweets').width;
|
||||||
|
currentLen += 10;
|
||||||
ctx.fillStyle = 'white';
|
ctx.fillStyle = 'white';
|
||||||
ctx.font = 'normal bold 18px Noto';
|
ctx.font = 'normal bold 18px Noto';
|
||||||
ctx.fillText(formatNumberK(likes), 31 + retweetsLen + 5 + retweetsWordLen + 10, base2StartY + 77);
|
ctx.fillText(formatNumberK(quoteTweets), currentLen, base2StartY + 77);
|
||||||
const likesLen = ctx.measureText(formatNumberK(likes)).width;
|
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.fillStyle = '#8899a6';
|
||||||
ctx.font = '18px Noto';
|
ctx.font = '18px Noto';
|
||||||
ctx.fillText('Likes', 31 + retweetsLen + 5 + retweetsWordLen + 10 + likesLen + 5, base2StartY + 77);
|
ctx.fillText('Likes', 31 + retweetsLen + 5 + retweetsWordLen + 10 + likesLen + 5, base2StartY + 77);
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "119.39.1",
|
"version": "119.39.2",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user