Utility class providing anchor and pivot calculations for menu positioning.
Thin Unity adapter over UiAnchorMapper (the single anchor→factor mapping), turning the
normalized factors into the Vector2 pivots/offsets the menu builders consume.
Inheritance
UnityMenuAnchorUtils
Assembly: Serenity.UnityMenu.Infrastructure.dll
public static class UnityMenuAnchorUtils
Methods
GetAnchorBasedPosition(UiAnchorType, Vector2)
Gets the position offset for anchor-based positioning.
Since anchors are already at corners/edges, we just offset by borderMargin.
Declaration
public static Vector2 GetAnchorBasedPosition(UiAnchorType alignment, Vector2 borderMargin)
Parameters
| Type |
Name |
Description |
| UiAnchorType |
alignment |
|
| Vector2 |
borderMargin |
|
Returns
GetAnchorPivotForAlignment(UiAnchorType)
Gets the anchor/pivot position based on the menu alignment type.
Declaration
public static Vector2 GetAnchorPivotForAlignment(UiAnchorType alignment)
Parameters
Returns
GetHorizontalAnchorForViewAlignment(UiAnchorType)
Gets the horizontal anchor value (0, 0.5, or 1) based on the view alignment.
Declaration
public static float GetHorizontalAnchorForViewAlignment(UiAnchorType alignment)
Parameters
Returns
IsViewYAlignmentBottom(IMenuSettingsDefinition)
Determines whether the view alignment is bottom-oriented.
Declaration
public static bool IsViewYAlignmentBottom(IMenuSettingsDefinition menuSettings)
Parameters
Returns