Skip to content

Label ​

Путь подключения: require "ProjectMotionUI/Components/Label"


Класс PMUI.Label ​

Наследуется от: PMUI.BaseElement

Методы и функции ​

PMUI.Label:new(text, font) ​

Creates a new text label with the specified content and font.

ПараметрТипОписание
textstring|nilInitial text content.
fontUIFont|nilFont used to render the text. Defaults to UIFont.Small.

Returns: PMUI.Label

PMUI.Label:SetText(text) ​

Updates the label text and recalculates its dimensions when auto sizing is enabled.

ПараметрТипОписание
textstring|nilNew text content.

Returns: PMUI.Label

PMUI.Label:SetFont(font) ​

Sets the font used to render the label. Recalculates the element dimensions when auto sizing is enabled.

ПараметрТипОписание
fontUIFontFont assigned to the label.

Returns: PMUI.Label

PMUI.Label:SetColor(r, g, b, a) ​

Sets the label text color.

ПараметрТипОписание
rnumberRed component (0.0-1.0).
gnumberGreen component (0.0-1.0).
bnumberBlue component (0.0-1.0).
anumber|nilAlpha component (0.0-1.0), defaults to 1.0.

Returns: PMUI.Label

PMUI.Label:SetAlign(align) ​

Sets the horizontal text alignment. Disables automatic sizing to preserve the manually assigned element dimensions.

ПараметрТипОписание
alignstringAlignment mode: "left", "center", or "right".

Returns: PMUI.Label

PMUI.Label:UpdateSizeFromText() ​

Calculates and updates the element dimensions based on the current text and font. Uses the text manager to measure the required width and height.

PMUI.Label:prerender() ​

Renders the label text using the configured font, color, and alignment. Text is positioned horizontally according to the selected alignment mode.