fix(scoreboard): the strip and the social bar now really share the frame
Reported: the ticker was painting OVER the socials. The coupling rule existed and was tested (ScoreboardLayout.ResolveEdges) but nothing ever CALLED it — the strip's Y still came from its own preference, so both bars landed on the south edge. Now the resolution runs at publish time: the social bar keeps its side, the scoreboard takes the other one, and its Y follows from that edge. The pair re-sorts whenever the social bar moves (the preview click-toggle) or shows/hides, because the rule is "resolve from what is visible", not a stored pairing. The layer also gains an Edge preference (Top/Bottom) in its properties, labelled "socials take the other" — a preference, never a claim on an occupied edge. Also stabilised the opacity assertion: it samples a plate-only pixel 5px from the left edge instead of the first semi-transparent pixel it finds (which could be anti-aliased text).
This commit is contained in:
@@ -55,12 +55,9 @@ public class ScoreboardRendererTests
|
||||
// Opacity: 20% and 80% must produce visibly different plate transparency.
|
||||
var faint = ScoreboardRenderer.Render(Tiles, new ScoreboardStyle("#FFFFFF", true, "#0000FF", 0.2));
|
||||
var solid = ScoreboardRenderer.Render(Tiles, new ScoreboardStyle("#FFFFFF", true, "#0000FF", 0.8));
|
||||
int AlphaOf(VideoFrame f)
|
||||
{
|
||||
for (var i = 3; i < f.BgraPixels.Length; i += 4)
|
||||
if (f.BgraPixels[i] is > 10 and < 245) return f.BgraPixels[i];
|
||||
return 0;
|
||||
}
|
||||
// Sample a plate-only pixel (5px in from the left edge, vertical middle): the text is
|
||||
// centred, so nothing anti-aliased can pollute the alpha reading.
|
||||
static int AlphaOf(VideoFrame f) => f.BgraPixels[((f.Height / 2) * f.Width + 5) * 4 + 3];
|
||||
Assert.InRange(AlphaOf(faint!), 35, 70); // ~20% of 255
|
||||
Assert.InRange(AlphaOf(solid!), 190, 220); // ~80% of 255
|
||||
Assert.True(AlphaOf(solid!) > AlphaOf(faint!) + 100, "the opacity slider must move the alpha");
|
||||
|
||||
Reference in New Issue
Block a user