Utility class providing anchor and pivot calculations for menu positioning.
Centralizes alignment-to-anchor mappings used across menu building operations.
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
GetHorizontalAnchorForMenuAlignment(UiAnchorType)
Gets the horizontal anchor value (0, 0.5, or 1) based on the menu alignment.
Declaration
public static float GetHorizontalAnchorForMenuAlignment(UiAnchorType alignment)
Parameters
Returns
IsMenuYAlignmentBottom(IMenuSettingsDefinition)
Determines whether the menu alignment is bottom-oriented.
Declaration
public static bool IsMenuYAlignmentBottom(IMenuSettingsDefinition menuSettings)
Parameters
Returns