fix(app): slice 7 fix round B item 10 — no row-selection band on column grids
VVS's own HudList grids (Monsters/Meta/Route/Items and every other
<list><column> grid this codebase has, present and future) have no
row-selection highlight at all — only the per-cell click callbacks are a
real VTank concept. UiMarkupList.DrawColumns painted a SelectedColor band
under the selected row anyway (a holdover from the legacy single-column
list path, which keeps its own band unchanged — that's a plain list, not a
VVS grid). Removed the band draw from DrawColumns only; SelectedIndexSource
still drives scroll-into-view, and every onclick/onchange callback is
untouched.
New test: ColumnGrids_NeverDrawARowSelectionBand (a column list with a
real in-range selected index must never paint SelectedColor). Mutation
check: before the fix this test was RED against the real code
("expected no SelectedColor fill in a column-based grid"); after removing
the band draw it's green.
tests/AcDream.Plugins.MossTank.Tests: 671/671 (unchanged — this is an
App-layer fix, MossTank markup only consumes the existing <column>
grammar).
tests/AcDream.App.Tests --filter Markup|Plugin|UiMenu|Slider: 277/3 skipped/280 (was 276/3/279, +1 new test).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
328faea995
commit
ed5378d9b0
2 changed files with 51 additions and 2 deletions
|
|
@ -320,12 +320,17 @@ public sealed class UiMarkupList : UiElement
|
|||
context.DrawFill(0f, 0f, Width, Height, BackgroundColor);
|
||||
context.DrawRectOutline(0f, 0f, Width, Height, BorderColor, 1f);
|
||||
|
||||
// Fix round B item 10 (owner/oracle: VVS's own HudList grids have NO
|
||||
// row-selection highlight at all — Monsters/Meta/Route/Items and
|
||||
// every other <list><column> grid). SelectedIndexSource above still
|
||||
// drives scroll-into-view; the SelectedColor band draw the legacy
|
||||
// single-column path (below, unaffected) uses is deliberately
|
||||
// skipped here. Every per-cell onclick/onchange callback is
|
||||
// unchanged — only the visual band is gone.
|
||||
int end = Math.Min(rowCount, _topRow + visibleRows);
|
||||
for (int index = _topRow; index < end; index++)
|
||||
{
|
||||
float y = (index - _topRow) * RowHeight;
|
||||
if (index == selected)
|
||||
context.DrawFill(1f, y + 1f, Width - 2f, RowHeight - 1f, SelectedColor);
|
||||
|
||||
for (int c = 0; c < columns.Count; c++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -551,6 +551,50 @@ public sealed class MarkupListColumnsTests
|
|||
"expected col0's icon clamped inside the 50px list width");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ColumnGrids_NeverDrawARowSelectionBand()
|
||||
{
|
||||
// Fix round B item 10 (owner/oracle: VVS's own HudList grids —
|
||||
// Monsters/Meta/Route/Items and every other <list><column> grid —
|
||||
// have no row-selection highlight at all; only the per-cell click
|
||||
// callbacks survive). DrawColumns must never paint SelectedColor,
|
||||
// even when SelectedIndexSource reports a real in-range row.
|
||||
var list = new UiMarkupList
|
||||
{
|
||||
Width = 100f, Height = 60f, RowHeight = 18f,
|
||||
SelectedIndexSource = () => 1,
|
||||
BackgroundColor = new Vector4(0f, 0f, 0f, 1f),
|
||||
BorderColor = default,
|
||||
SelectedColor = new Vector4(1f, 0f, 0f, 1f), // distinct, unmistakable
|
||||
Columns = new[]
|
||||
{
|
||||
UiMarkupListColumn.Text(100f, () => new[] { "Row0", "Row1", "Row2" }, null),
|
||||
},
|
||||
};
|
||||
var (renderer, ctx) = MakeContext(200f, 200f);
|
||||
|
||||
list.DrawSelfAndChildren(ctx);
|
||||
|
||||
bool anySelectedFill = renderer.DebugSpriteSegmentVerts.Any(s =>
|
||||
{
|
||||
if (s.Texture != 0u)
|
||||
return false;
|
||||
for (int q = 0; q + 48 <= s.Verts.Count; q += 48)
|
||||
{
|
||||
float r = s.Verts[q + 4], g = s.Verts[q + 5], b = s.Verts[q + 6], a = s.Verts[q + 7];
|
||||
if (MathF.Abs(r - list.SelectedColor.X) < 0.01f
|
||||
&& MathF.Abs(g - list.SelectedColor.Y) < 0.01f
|
||||
&& MathF.Abs(b - list.SelectedColor.Z) < 0.01f
|
||||
&& MathF.Abs(a - list.SelectedColor.W) < 0.01f)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
Assert.False(anySelectedFill, "expected no SelectedColor fill in a column-based grid");
|
||||
}
|
||||
|
||||
// ── Draw-level: column x-offsets, check glyph, icon, clipping ────────────
|
||||
|
||||
private static (TextRenderer renderer, UiRenderContext ctx) MakeContext(float w, float h)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue