Class DiagramColumnLayout
Pure arithmetic for laying out one column of a two-kind card diagram, extracted from
Serenity.EventDispatcher.Infrastructure.Editor.SerenitySignalFlowBrowserWindow: which candidate
cards become visible slots once a column is truncated to its maximum card count, where the trailing
"show N more…" pseudo-card goes, and how far a column's second card kind gets pushed down to leave
room for a section header. Card measurement (width/height in screen units) deliberately stays with
the caller, since it depends on GUIStyle text metrics this type knows nothing about.
Inherited Members
Namespace: Serenity.Shared.Layout
Assembly: Serenity.Shared.dll
Syntax
public static class DiagramColumnLayout
Methods
BuildAssetPathSlots(int, IReadOnlyList<string>)
Builds one card slot per asset path, titled by its short asset name.
Declaration
public static List<DiagramColumnSlot> BuildAssetPathSlots(int kind, IReadOnlyList<string> paths)
Parameters
| Type | Name | Description |
|---|---|---|
| int | kind | |
| IReadOnlyList<string> | paths |
Returns
| Type | Description |
|---|---|
| List<DiagramColumnSlot> |
BuildReactionSlots(int, IReadOnlyList<Type>)
Builds one card slot per reaction type, titled by its short type name.
Declaration
public static List<DiagramColumnSlot> BuildReactionSlots(int kind, IReadOnlyList<Type> reactionTypes)
Parameters
| Type | Name | Description |
|---|---|---|
| int | kind | |
| IReadOnlyList<Type> | reactionTypes |
Returns
| Type | Description |
|---|---|
| List<DiagramColumnSlot> |
ComputeColumnTruncation(int, bool, int)
Decides, for one column, how many candidate sources become real slots and whether a trailing
pseudo-card ("show N more…" when collapsed, "show less" when expanded) is present. Reserves one
slot for the pseudo-card so the slot count SelectVisibleSlots(IReadOnlyList<DiagramColumnSlot>, DiagramColumnTruncation, int) returns never exceeds
maxVisibleCount.
Declaration
public static DiagramColumnTruncation ComputeColumnTruncation(int totalCount, bool expanded, int maxVisibleCount)
Parameters
| Type | Name | Description |
|---|---|---|
| int | totalCount | How many candidate cards the column has in total. |
| bool | expanded | Whether the caller's "show all" toggle is currently on. |
| int | maxVisibleCount | The most slots (real cards + pseudo-card) the column may show while collapsed. |
Returns
| Type | Description |
|---|---|
| DiagramColumnTruncation |
SelectVisibleSlots(IReadOnlyList<DiagramColumnSlot>, DiagramColumnTruncation, int)
Selects which of sources become real column slots, honoring
truncation: only its first VisibleCount sources are kept, and a trailing
overflow slot of overflowKind (null title/sub/tooltip — the caller's cue to draw
the pseudo-card instead of a real one) is appended when the column was truncated.
Declaration
public static IReadOnlyList<DiagramColumnSlot> SelectVisibleSlots(IReadOnlyList<DiagramColumnSlot> sources, DiagramColumnTruncation truncation, int overflowKind)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<DiagramColumnSlot> | sources | |
| DiagramColumnTruncation | truncation | |
| int | overflowKind |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<DiagramColumnSlot> |
ShiftSecondKindDown(float[], IReadOnlyList<int>, int, bool, float, ref float)
Shifts every slot from the first occurrence of secondKind onward (including a
trailing overflow slot) down by sectionHeaderHeight, and grows
totalHeight to match, so a section header fits between the column's two card
kinds. A no-op when only one kind is visible.
Declaration
public static void ShiftSecondKindDown(float[] columnY, IReadOnlyList<int> slotKinds, int secondKind, bool hasBothKinds, float sectionHeaderHeight, ref float totalHeight)
Parameters
| Type | Name | Description |
|---|---|---|
| float[] | columnY | Each slot's current Y offset within the column; mutated in place. |
| IReadOnlyList<int> | slotKinds | Each slot's kind tag, in the same order as |
| int | secondKind | The kind whose first slot marks where the shift begins. |
| bool | hasBothKinds | Whether the column actually shows both kinds (a no-op offset when false). |
| float | sectionHeaderHeight | How far to push the second kind down. |
| float | totalHeight | The column's total stacked height; grown by the same offset. |