center text in copilot
Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user