koishi-plugin-vsinger-gacha 1.5.2 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/handbook.js +3 -1
- package/lib/render/kit.js +10 -9
- package/package.json +1 -1
package/lib/handbook.js
CHANGED
|
@@ -209,7 +209,9 @@ async function render({ game, store, uid, displayName, outDir, tagsDir, thumbsDi
|
|
|
209
209
|
const W = PAD * 2 + part.length * COLW + (part.length - 1) * GAP * 2;
|
|
210
210
|
// 头部高度随图标自适应(避免标题压到第一个系列条)
|
|
211
211
|
const _R = Math.max(26, Math.min(72, Math.round(W * 0.017)));
|
|
212
|
-
const
|
|
212
|
+
const _BW = Math.max(150, Math.min(400, Math.round(W * 0.13)));
|
|
213
|
+
const _BH = Math.round(_BW * 0.5);
|
|
214
|
+
const HEADY = Math.max(HEAD, 34 + Math.max(_R * 2, _BH) + 40);
|
|
213
215
|
const H = HEADY + Math.max(...part.map((c) => c.reduce((a, b) => a + b.h, 0))) + 70;
|
|
214
216
|
const canvas = Canvas.createCanvas(W, H);
|
|
215
217
|
const g = canvas.getContext('2d');
|
package/lib/render/kit.js
CHANGED
|
@@ -121,26 +121,27 @@ function header(g, o) {
|
|
|
121
121
|
g.fillText(o.subtitle, x + R * 2 + 18, y + Math.max(40, R * 2 - 8));
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
//
|
|
124
|
+
// 右侧徽章(按画布宽度自适应)
|
|
125
125
|
if (o.badge != null) {
|
|
126
|
-
const bw =
|
|
127
|
-
const bh =
|
|
126
|
+
const bw = Math.max(150, Math.min(400, Math.round(W * 0.13)));
|
|
127
|
+
const bh = Math.round(bw * 0.5);
|
|
128
128
|
const bx = x + W - bw;
|
|
129
129
|
panel(g, bx, y - 4, bw, bh, { radius: RADIUS.md, fill: 'rgba(255,255,255,0.95)' });
|
|
130
130
|
g.fillStyle = COLOR.accent;
|
|
131
|
-
g.font = `bold
|
|
132
|
-
g.fillText(String(o.badge), bx +
|
|
131
|
+
g.font = `bold ${Math.round(bh * 0.46)}px ${FONT}`;
|
|
132
|
+
g.fillText(String(o.badge), bx + bw * 0.1, y + bh * 0.06);
|
|
133
133
|
g.fillStyle = COLOR.textSub;
|
|
134
|
-
g.font =
|
|
135
|
-
g.fillText(String(o.badgeSub || ''), bx +
|
|
134
|
+
g.font = `${Math.round(bh * 0.2)}px ${FONT}`;
|
|
135
|
+
g.fillText(String(o.badgeSub || ''), bx + bw * 0.1, y + bh * 0.6);
|
|
136
136
|
// 进度条
|
|
137
137
|
const pct = Math.max(0, Math.min(1, Number(o.progress || 0)));
|
|
138
|
+
const pbH = Math.max(5, Math.round(bh * 0.08));
|
|
138
139
|
g.fillStyle = 'rgba(74,144,217,0.15)';
|
|
139
|
-
roundRect(g, bx +
|
|
140
|
+
roundRect(g, bx + bw * 0.08, y + bh - pbH - 8, bw * 0.84, pbH, pbH / 2);
|
|
140
141
|
g.fill();
|
|
141
142
|
if (pct > 0) {
|
|
142
143
|
g.fillStyle = COLOR.accent;
|
|
143
|
-
roundRect(g, bx +
|
|
144
|
+
roundRect(g, bx + bw * 0.08, y + bh - pbH - 8, Math.max(6, bw * 0.84 * pct), pbH, pbH / 2);
|
|
144
145
|
g.fill();
|
|
145
146
|
}
|
|
146
147
|
}
|