Class UiAnchorMapper
Pure mapping from a UiAnchorType to normalized per-axis placement factors — the single source for every "which corner/edge does this anchor mean" switch. A factor of 0/0.5/1 places the element at the start/center/end of the axis: horizontally 0 = left and 1 = right; vertically the Unity-pivot convention is used, 0 = bottom and 1 = top.
Inherited Members
Namespace: Serenity.Ui.Domain.Services
Assembly: Serenity.Ui.Domain.dll
Syntax
public static class UiAnchorMapper
Remarks
Engine-free so the Menu runtime (pivot/position math) and Ui editor tooling (preview placement) both derive their anchor handling from here instead of re-encoding the nine-case switch.
Methods
HorizontalFactor(UiAnchorType)
The horizontal placement factor: 0 = left edge, 0.5 = center, 1 = right edge.
Declaration
public static float HorizontalFactor(UiAnchorType anchor)
Parameters
| Type | Name | Description |
|---|---|---|
| UiAnchorType | anchor | The anchor to map. |
Returns
| Type | Description |
|---|---|
| float | The normalized horizontal factor. |
IsBottom(UiAnchorType)
Whether the anchor sits on the bottom edge.
Declaration
public static bool IsBottom(UiAnchorType anchor)
Parameters
| Type | Name | Description |
|---|---|---|
| UiAnchorType | anchor | The anchor to test. |
Returns
| Type | Description |
|---|---|
| bool | True for BOTTOM/BOTTOM_LEFT/BOTTOM_RIGHT. |
VerticalFactor(UiAnchorType)
The vertical placement factor (Unity pivot convention): 0 = bottom edge, 0.5 = center, 1 = top edge.
Declaration
public static float VerticalFactor(UiAnchorType anchor)
Parameters
| Type | Name | Description |
|---|---|---|
| UiAnchorType | anchor | The anchor to map. |
Returns
| Type | Description |
|---|---|
| float | The normalized vertical factor. |