Skip to content
docsv0.3.0

TuiBounds

A rectangular region in terminal cell coordinates (`$x`/`$y` from the top-left, in columns/rows), used throughout the TUI layer for viewport, node, and overlay placement.

TuiBounds::__construct()

public function __construct(int $x, int $y, int $width, int $height):

Parameters

Parameters of __construct()
NameTypeDescription
$xint
$yint
$widthint
$heightint

Throws

\InvalidArgumentException If any of `$x`, `$y`, `$width`, `$height` is negative.

TuiBounds::right()

public function right(): int

The x-coordinate just past this region's right edge (`$x + $width`).

TuiBounds::bottom()

public function bottom(): int

The y-coordinate just past this region's bottom edge (`$y + $height`).

TuiBounds::inset()

public function inset(int $amount): self

Returns a new region shrunk by `$amount` on every side (e.g. for padding). `$amount` is clamped to non-negative, and the resulting width/height are clamped to zero rather than going negative when `$amount` exceeds half of this region's size.

Parameters

Parameters of inset()
NameTypeDescription
$amountint