fix(scoreboard): the defaults were never applied — a record struct zero-initialises

Creator's defaults: white text, Background ON (black, 20%), speed capped at 200 px/s, text size shown
in real pixels, and "plate" dropped from the label.

The important find is underneath those: `ScoreboardStyle` is a record STRUCT, and `new
ScoreboardStyle()` zero-initialises — it does NOT run the constructor's parameter defaults. So the
shipped strip had null text colour, NO background and zero opacity, whatever the source said. That is
why the Background checkbox and the opacity slider looked like they had no code behind them: the
renderer was faithfully drawing the zeros it was handed.

An explicit parameterless constructor now carries the real defaults, and the renderer test asserts
them (white / on / black / 0.20 / max speed 200) so this class of silent-zero cannot return.

Readouts fixed too: the opacity and text-size setters never raised their own property, so the numbers
never moved while the render did. Text size now reads "24 px" instead of a bare slider value, and
snaps to whole pixels.
This commit is contained in:
2026-10-30 15:24:14 -07:00
parent 28525c90aa
commit c03acd0aa0
6 changed files with 43 additions and 9 deletions
+8
View File
@@ -193,6 +193,9 @@ public partial class MainViewModel
{
_scoreboardStyle = _scoreboardStyle with { BackgroundOpacity = Math.Clamp(value, 0, 1) };
PushStyle();
// The readout binds THIS property: without its own raise the number never moves even
// though the render does (creator: "bzzzt!").
OnPropertyChanged(nameof(ScoreboardBackgroundOpacity));
}
}
@@ -206,9 +209,14 @@ public partial class MainViewModel
FontSize = Math.Clamp(value, ScoreboardLayout.FloorFontSize, ScoreboardLayout.MaxFontSize),
};
PushStyle();
OnPropertyChanged(nameof(ScoreboardFontSize)); // same bug as the opacity readout
OnPropertyChanged(nameof(ScoreboardFontSizeLabel));
}
}
/// <summary>"24 px" — the panel shows real pixels, not a bare slider number.</summary>
public string ScoreboardFontSizeLabel => $"{_scoreboardStyle.FontSize:0} px";
/// <summary>The colours offered for text and plate: the app's one palette.</summary>
public IReadOnlyList<NamedColor> ScoreboardColorOptions => BorderColorPalette.All;