Skip to content

UIAnchorResolver Class

Definition

Namespace: Brine2D.UI

Helpers for resolving UIAnchor origins and computing hit-test offsets for anchored components.

C#
internal static class UIAnchorResolver

Inheritance System.Object → UIAnchorResolver

Methods
ComputeInputOffsetForAnchored\(IUIComponent, Vector2\) Returns the offset to add to incoming screen positions before hit-testing an anchored component. Returns System.Numerics.Vector2.Zero for non-anchored components and for Brine2D.UI.UIAnchor.TopLeft with no offset.
Resolve\(UIAnchor, float, float, Vector2\) Resolves the top-left screen-space origin for a component of the given size anchored at anchor within a screen of screenWidth x screenHeight. Center/right/bottom anchors are size-aware: they subtract the component's own size \(fully for edge anchors, by half for center anchors\) so the component's edge/center lands exactly on the anchor point rather than the component's top-left corner.
ResolveAnchoredPosition\(IAnchoredUIComponent, Vector2\) Returns the resolved screen-space position for an anchored component without modifying its stored Position.