Class LayoutMath
Margin and size arithmetic that follows how IcyUI arranges an element inside its slot.
public static class LayoutMath
- Inheritance
-
LayoutMath
- Inherited Members
Remarks
Left/Top: positioned at the start margin.Right/Bottom: positioned against the end margin.Center, andStretchwith an explicit size: centered in the slack, then offset by the start margin; the end margin is ignored.Stretchwith no size: fills the slot between both margins.
Methods
Kind(HorizontalAlignment, float)
Classifies an axis from its alignment and explicit size.
public static AxisKind Kind(HorizontalAlignment alignment, float size)
Parameters
alignmentHorizontalAlignmentThe horizontal alignment.
sizefloatThe explicit width, or NaN.
Returns
- AxisKind
The axis kind.
Kind(VerticalAlignment, float)
Classifies an axis from its alignment and explicit size.
public static AxisKind Kind(VerticalAlignment alignment, float size)
Parameters
alignmentVerticalAlignmentThe vertical alignment.
sizefloatThe explicit height, or NaN.
Returns
- AxisKind
The axis kind.
Move(UIElement, Thickness, int, int)
Gets the margin that moves element by (dx, dy) without
changing its size.
public static Thickness Move(UIElement element, Thickness start, int dx, int dy)
Parameters
elementUIElementThe element, for its alignment and explicit size.
startThicknessThe margin to move from.
dxintThe horizontal offset.
dyintThe vertical offset.
Returns
- Thickness
The new margin.
ResizeAxis(AxisKind, int, int, int, int, bool, bool, bool)
Resizes one axis of an element by dragging its start or end edge.
public static AxisResize ResizeAxis(AxisKind kind, int startSize, int startMarginStart, int startMarginEnd, int delta, bool isStartEdge, bool anchored, bool sizeStretched = false)
Parameters
kindAxisKindHow the element is aligned on this axis.
startSizeintThe element's size on this axis when the gesture started.
startMarginStartintThe start margin (left or top) when the gesture started.
startMarginEndintThe end margin (right or bottom) when the gesture started.
deltaintHow far the dragged edge moved, positive towards the end.
isStartEdgeboolWhether the start edge (left or top) is dragged.
anchoredbooltrue when the container anchors the element on this axis (a stack's stacking direction), so only the size changes, whatever the alignment.
sizeStretchedbooltrue when the container sizes its slot to the element on this axis (a stack's cross axis), so a Stretched element gets an explicit size instead of a margin: a margin can't grow a slot that follows the element.
Returns
- AxisResize
The new size (null when the size isn't written) and margins.