fix: move day label update before early return, add line-height
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -35,6 +35,7 @@ export class TimeIndicator {
|
||||
color: #e0d0b0;
|
||||
text-shadow: 0 0 4px #00000088;
|
||||
white-space: nowrap;
|
||||
line-height: 1;
|
||||
`;
|
||||
this.dayLabel.textContent = 'Day 1';
|
||||
|
||||
@@ -129,17 +130,17 @@ export class TimeIndicator {
|
||||
|
||||
/** @param gameTime normalized 0-1 through the full day/night cycle */
|
||||
update(gameTime: number, dayNumber: number): void {
|
||||
// Only update when visually changed (quantize to avoid thrash)
|
||||
const key = Math.round(gameTime * 200).toString();
|
||||
if (key === this.lastTimeKey) return;
|
||||
this.lastTimeKey = key;
|
||||
|
||||
// Update day label when day changes
|
||||
// Update day label when day changes (before early return so it's never skipped)
|
||||
if (dayNumber !== this.lastDayNumber) {
|
||||
this.lastDayNumber = dayNumber;
|
||||
this.dayLabel.textContent = `Day ${dayNumber}`;
|
||||
}
|
||||
|
||||
// Only update when visually changed (quantize to avoid thrash)
|
||||
const key = Math.round(gameTime * 200).toString();
|
||||
if (key === this.lastTimeKey) return;
|
||||
this.lastTimeKey = key;
|
||||
|
||||
// gameTime 0-1 maps linearly across the track
|
||||
// Track total inner width = daySection + 2px divider + nightSection
|
||||
const totalWidth = 240 + 2; // 240px sections + 2px divider
|
||||
|
||||
Reference in New Issue
Block a user