GridMetrics class Core
The fully-solved geometry of one layout, produced by LayoutSolver. Everything needed to place, hit-test and diff slots, computable without rendering.
A "slot" is a (row, column) cell. In table mode a row is one item and each column one property; in card mode each populated cell is one item, flowed row-major across GridMetrics.ColumnsPerRow.
public sealed class GridMetrics
- Namespace
- ArionUI.Core
- Package
- ArionUI.Core ·
dotnet add package ArionUI.Core --prerelease
Constructors
GridMetrics
public GridMetrics(LayoutMode mode, int itemCount, long rowCount, int columnsPerRow, ISlotSizeProvider rows, double rowSeparator, double[] colStart, double[] colWidth, double[] colSep, Extent extent);Public so that a custom LayoutSpec can build its own solve result.
Properties
AnchoredScrollY
public double AnchoredScrollY { get; }Where the solve wants the vertical scroll to be, so that what the user reads stays where it is on screen while the rows above it change height (CSS scroll anchoring); NaN, the default, leaves the scroll where it is. The engine applies it when it takes these metrics, clamped like any scroll.
ColumnCount
public int ColumnCount { get; }Number of grid columns.
ColumnHidden
public int ColumnHidden { get; set; }The dragged column's index while reordering (-1 = none). The renderer skips it — the floating ghost represents it, and its slot closes via GridMetrics.ColumnShift.
ColumnShift
public double[]? ColumnShift { get; set; }Transient per-column X shift for the live column-reorder preview; null = none. Applied to the drawing getters only (ColumnLeft/Right/SlotRect); GridMetrics.ColumnAt stays on the raw layout so the drop target is computed against real boundaries and cannot chase its own preview.
ColumnsPerRow
public int ColumnsPerRow { get; }Columns per row; equals ColumnCount for table, wrap count for cards.
DeviceScale
public double DeviceScale { get; set; }Device pixels per logical unit, mirrored from the engine. The curtain snaps its travel onto that grid — see GridMetrics.RevealTravel.
Extent
public Extent Extent { get; }Total scrollable extent of the content, both axes.
ItemCount
public int ItemCount { get; }Number of items this geometry describes. Equals GridMetrics.RowCount in table mode; smaller for cards (several per row).
Mode
public LayoutMode Mode { get; }Table or cards — what a cell means.
RevealEdgeY
public double RevealEdgeY { get; }The curtain edge in content y: the band is visible in [RawTop(from), edge). Everything above is untouched and everything below rides the edge, which lets a renderer composite a curtain frame (shift below, clip the band) instead of drawing one. -1 when no curtain is armed.
RevealInitialShift
public double RevealInitialShift { get; set; }The GridMetrics.RevealShift the animation started at (0 for a collapse, the full span for an expand): the shift at which pixels buffered before arming are still correct. A blit renderer moves the below-edge pixels by (current − initial) on the first curtain frame. Stamped by the animator right after arming.
RevealShift
public double RevealShift { get; }How far the content below the band currently sits above its raw position. This — not the scroll delta — is how far those pixels moved since the last frame. 0 when no curtain is armed.
RevealVisibleSpan
public double RevealVisibleSpan { get; }The on-screen band height the curtain actually animates over (≤ the range's full height) — the host derives the duration from it.
RowCount
public long RowCount { get; }Number of grid rows — the axis that scrolls.
RowRevealFrom
public long RowRevealFrom { get; }First row of the curtain band, or -1 when no curtain is armed.
RowRevealScale
public double RowRevealScale { get; set; }Openness of the curtain: 1 = fully open, 0 = fully shut. The host eases this value per frame; the geometry follows.
RowRevealTo
public long RowRevealTo { get; }Last row of the curtain band (inclusive), or -1.
RowSeparator
public double RowSeparator { get; }Uniform row-separator strength (logical units). 0 = no line (cards).
Methods
BeginRowReveal
public void BeginRowReveal(long from, long to, double visibleSpan);Arm the curtain over a row range. visibleSpan caps the animated travel to what is on screen (clamped to the range's full height); everything beyond it collapses/expands instantly and invisibly below the viewport.
ColumnAt
public int ColumnAt(double x, out bool onSeparator);Column whose content band contains logical x. Sets onSeparator when x is inside a column separator track (boundary index = returned column).
ColumnLeft
public double ColumnLeft(int col);Left edge of the column, including the reorder preview shift.
ColumnLeftRaw
public double ColumnLeftRaw(int col);Left edge without the reorder preview — for the drop-target computation, which must run against the real boundaries.
ColumnOfItem
public int ColumnOfItem(int itemIndex);Column of a given item (cards: its position within the wrap row; table: it has none, so 0).
ColumnRight
public double ColumnRight(int col);Right edge of the column, including the reorder preview shift.
ColumnRightRaw
public double ColumnRightRaw(int col);Right edge without the reorder preview; counterpart of GridMetrics.ColumnLeftRaw.
ColumnSeparator
public double ColumnSeparator(int col);Separator strength after column col.
ColumnWidth
public double ColumnWidth(int col);Content width of the column, without its separator.
EndRowReveal
public void EndRowReveal();Disarms the curtain once the final geometry is in place; the metrics then describe the bare rows again.
IsPopulated
public bool IsPopulated(long row, int col);Whether the cell holds an item. False only for the empty trailing slots of the last card row.
ItemIndexAt
public int ItemIndexAt(long row, int col);The item shown in cell (row, col), or -1 for an empty trailing card slot.
Neighbour
public CellPos Neighbour(CellPos origin, int dColumn, int dRow);The slot one step away, in the layout's own terms. Clamped, never wrapping past the ends.
In a table an item is a row and the column a separate axis, so the deltas are independent. In cards one item occupies one slot: moving right is the next item, moving down a whole row of them, and a "column" is only where the item wrapped.
RawRowBottom
public double RawRowBottom(long row);Row bottom without the curtain clamp, separator included.
RawRowTop
public double RawRowTop(long row);Row top without the curtain clamp. GridMetrics.RowTop pins every band row at the edge, so only this can say which rows a moving edge has just uncovered on an expand.
RowAt
public long RowAt(double y, out bool onSeparator);Row whose content band contains logical y. If y falls inside a row separator track, onSeparator is set and the row returned is the one ABOVE the separator (boundary index = row).
RowBottom
public double RowBottom(long row);Bottom edge of the row (top plus visible height), excluding the separator below it.
RowEnd
public CellPos RowEnd(CellPos origin, int itemCount);Last POPULATED slot of that row (End / Ctrl+Right). In cards the final row is usually short, so the last column is not where the data ends.
RowHeight
public double RowHeight(long row);Visible height of a row: under a curtain the truncated height (up to the moving edge), otherwise the full one.
RowInActiveReveal
public bool RowInActiveReveal(long row);True while row is truncated by the curtain (it crosses or lies past the edge). The renderer clips such rows to their reduced height and skips their separator line.
RowOfItem
public long RowOfItem(int itemIndex);Row that displays a given item (table: the item's row; cards: the wrap row). Inverse of GridMetrics.ItemIndexAt for the row axis.
RowStart
public CellPos RowStart(CellPos origin);First slot of origin's row (Home / Ctrl+Left).
RowTop
public double RowTop(long row);Logical top y of a row (content), separators included in the stack.
SlotRect
public LogRect SlotRect(long row, int col);The cell rectangle in logical units, including curtain truncation and the reorder preview — exactly as drawn.
