center text in copilot

Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
2026-04-10 12:25:23 +02:00
parent 03468d4ca4
commit 9b247a8e76
+3 -3
View File
@@ -105,14 +105,14 @@ class CopilotAction extends ActionBase {
const color = pct <= 0.5 ? '#4caf50' : pct <= 0.8 ? '#ffeb3b' : '#f44336';
const displayText = value.toFixed(1) + '%';
const fSize = displayText.length > 6 ? 28 : 34;
const fSize = displayText.length > 5 ? 28 : 34;
ctx.fillStyle = color;
ctx.font = `bold ${fSize}px "Source Han Sans SC"`;
ctx.fillText(displayText, cx, cy + 8);
ctx.fillText(displayText, cx, cy);
} else {
ctx.fillStyle = isError ? '#ff6b6b' : '#666666';
ctx.font = 'bold 28px "Source Han Sans SC"';
ctx.fillText(isError ? 'ERR' : 'N/A', cx, cy + 8);
ctx.fillText(isError ? 'ERR' : 'N/A', cx, cy);
}
// Label — bottom