Class TableColumnLayout
Pure arithmetic for a resizable-column table: each column's initial width honoring a minimum, and how a
drag on the handle between two adjacent columns redistributes their combined width. Extracted so an IMGUI
wrapper (SerenityTableGui) only has to feed and read floats, and the invariant that no drag can push
a neighbor thinner than its minimum, or change the pair's combined width, is assertable without any
editor state.
Inherited Members
Namespace: Serenity.Shared.Layout
Assembly: Serenity.Shared.dll
Syntax
public static class TableColumnLayout
Methods
ClampDrag(float, float, float, float, float)
Resizes two adjacent columns by delta (the drag distance), taking from one and
giving to the other so their combined width never changes, and never pushing either one below its
minimum.
Declaration
public static (float LeftWidth, float RightWidth) ClampDrag(float leftWidth, float rightWidth, float delta, float leftMinimum, float rightMinimum)
Parameters
| Type | Name | Description |
|---|---|---|
| float | leftWidth | The left column's current width. |
| float | rightWidth | The right column's current width. |
| float | delta | How far the handle moved; positive widens the left column. |
| float | leftMinimum | The narrowest the left column may become. |
| float | rightMinimum | The narrowest the right column may become. |
Returns
| Type | Description |
|---|---|
| (float X, float Y) |
Solve(float, IReadOnlyList<ColumnSpec>)
Solves each column's initial width: fixed columns get their requested width (never below their
minimum), flex columns share whatever width is left over in proportion to their weight — also never
below their minimum, even if that means the columns together run wider than
availableWidth.
Declaration
public static float[] Solve(float availableWidth, IReadOnlyList<ColumnSpec> specs)
Parameters
| Type | Name | Description |
|---|---|---|
| float | availableWidth | The total width the columns are laid out inside. |
| IReadOnlyList<ColumnSpec> | specs | One spec per column, in column order. |
Returns
| Type | Description |
|---|---|
| float[] |