Class reference

AspectRatioContainer

Inherits Container

A container that preserves the proportions of its child controls.

Description

A container type that arranges its child controls in a way that preserves their proportions automatically when the container is resized. Useful when a container has a dynamic size and the child nodes must adjust their sizes accordingly without losing their aspect ratios.

Properties

int alignment_horizontal = 1

Specifies the horizontal relative position of child controls.

int alignment_vertical = 1

Specifies the vertical relative position of child controls.

float ratio = 1.0

The aspect ratio to enforce on child controls. This is the width divided by the height. The ratio depends on the stretch_mode.

int stretch_mode = 2

The stretch mode used to align child controls.

Constants

STRETCH_WIDTH_CONTROLS_HEIGHT = 0

Enum: StretchMode

The height of child controls is automatically adjusted based on the width of the container.

STRETCH_HEIGHT_CONTROLS_WIDTH = 1

Enum: StretchMode

The width of child controls is automatically adjusted based on the height of the container.

STRETCH_FIT = 2

Enum: StretchMode

The bounding rectangle of child controls is automatically adjusted to fit inside the container while keeping the aspect ratio.

STRETCH_COVER = 3

Enum: StretchMode

The width and height of child controls is automatically adjusted to make their bounding rectangle cover the entire area of the container while keeping the aspect ratio. When the bounding rectangle of child controls exceed the container's size and Control.clip_contents is enabled, this allows to show only the container's area restricted by its own bounding rectangle.

ALIGNMENT_BEGIN = 0

Enum: AlignmentMode

Aligns child controls with the beginning (left or top) of the container.

ALIGNMENT_CENTER = 1

Enum: AlignmentMode

Aligns child controls with the center of the container.

ALIGNMENT_END = 2

Enum: AlignmentMode

Aligns child controls with the end (right or bottom) of the container.

Tutorials

Source revision 5592dc3a7a61
Connection interrupted. Reload×

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.