Table of Contents

Class PortalPositioner

Namespace
SharpConsoleUI.Layout
Assembly
SharpConsoleUI.dll

Static utility for calculating portal overlay positions with automatic flip and clamping logic. Extracts the shared positioning pattern from DropdownControl and MenuControl into a reusable component.

public static class PortalPositioner
Inheritance
PortalPositioner
Inherited Members

Methods

Calculate(PortalPositionRequest)

Calculates the optimal position for a portal overlay.

public static PortalPositionResult Calculate(PortalPositionRequest request)

Parameters

request PortalPositionRequest

The positioning request describing anchor, size, and constraints.

Returns

PortalPositionResult

The calculated position result.

CalculateFromPoint(Point, Size, Rectangle, PortalPlacement, Size)

Calculates the optimal position for a portal anchored at a single point (e.g. a cursor position) rather than a rectangle.

public static PortalPositionResult CalculateFromPoint(Point anchor, Size contentSize, Rectangle screenBounds, PortalPlacement placement = PortalPlacement.BelowOrAbove, Size minSize = default)

Parameters

anchor Point

The point anchor (e.g. cursor position).

contentSize Size

The desired size of the portal content.

screenBounds Rectangle

The available screen/window area to position within.

placement PortalPlacement

Preferred placement direction (default: BelowOrAbove).

minSize Size

Minimum dimensions to enforce on the result.

Returns

PortalPositionResult

The calculated position result.