Fix custom clock hands offset and decimal preset

This commit is contained in:
2026-06-09 19:30:03 +01:00
parent daf4d4331c
commit 943deb6e88
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -131,7 +131,7 @@ export function CustomClock() {
displayValue = rawValue;
}
const angle = direction * valueToAngle(displayValue, absUnits, 0);
const angle = direction * valueToAngle(displayValue, absUnits, 0) - Math.PI / 2;
context.beginPath();
context.strokeStyle = getHandColor(i, total);
+1 -1
View File
@@ -31,7 +31,7 @@ export const PRESETS: Record<PresetName, ClockConfig> = {
cyclesPerDay: 2,
},
decimal: {
hands: [10, 10, 10],
hands: [10, 100, 100],
numberStyle: 'arabic',
cyclesPerDay: 1,
},
+2 -2
View File
@@ -181,7 +181,7 @@ export function drawDigitalClock(params: DigitalClockParams): void {
let totalWidth = 0;
for (let i = 0; i < hands.length; i++) {
const maxUnits = getDigitalMaxUnits(i, hands, cyclesPerDay);
const digitCount = maxUnits.toString().length;
const digitCount = (maxUnits - 1).toString().length;
totalWidth += digitCount * (digitWidth + spacing);
if (i < hands.length - 1) {
totalWidth += colonWidth + spacing;
@@ -194,7 +194,7 @@ export function drawDigitalClock(params: DigitalClockParams): void {
for (let i = 0; i < hands.length; i++) {
const value = Math.floor(getDigitalValue(dayFraction, i, hands, cyclesPerDay));
const maxUnits = getDigitalMaxUnits(i, hands, cyclesPerDay);
const digitCount = maxUnits.toString().length;
const digitCount = (maxUnits - 1).toString().length;
const valueStr = value.toString().padStart(digitCount, '0');
for (const char of valueStr) {