import type { Context } from "../../../context"; import * as BABYLON from "../../../../gui-enriched-babylon"; import * as Inputs from "../../../inputs"; /** * Text labels: a block of text with a color, font size, alignment, optional outline, wrapping and * line spacing. Use one for titles and readouts next to other controls. */ export declare class BabylonGuiTextBlock { constructor(_context: Context); /** * Creates a block of text with a color and font size; sizes are pixel strings or fractions of * the parent, and a size left out is chosen by the engine. * @param inputs - The name, the text, the color, the optional size and the font size * @returns The text block * @group create * @shortname create text block * @disposableOutput true * @example * ```typescript * const title = bitbybit.babylon.gui.textBlock.createTextBlock({ name: "title", text: "Radius", color: "#f0cebb", width: "300px", height: "40px", fontSize: 24 }); * panel.addControl(title); * ``` */ createTextBlock(inputs: Inputs.BabylonGui.CreateTextBlockDto): BABYLON.GUI.TextBlock; /** * Sets where the text sits inside its block: left, center or right, and top, center or bottom. * @param inputs - The text block and the two alignments * @returns The same text block * @group positioning * @shortname align text block text * @example * ```typescript * bitbybit.babylon.gui.textBlock.alignText({ control: title, horizontalAlignment: Bit.Inputs.BabylonGui.horizontalAlignmentEnum.left, verticalAlignment: Bit.Inputs.BabylonGui.verticalAlignmentEnum.center }); * ``` */ alignText(inputs: Inputs.BabylonGui.AlignmentDto): BABYLON.GUI.TextBlock; /** * Draws an outline around the letters of a text block, `outlineWidth` pixels wide in * `outlineColor`, which keeps text readable over a busy scene; 0 removes it. * @param inputs - The text block, the outline width and the outline color * @returns The same text block * @group set * @shortname text outline * @example * ```typescript * bitbybit.babylon.gui.textBlock.setTextOutline({ textBlock: title, outlineWidth: 2, outlineColor: "black" }); * ``` */ setTextOutline(inputs: Inputs.BabylonGui.SetTextBlockTextOutlineDto): BABYLON.GUI.TextBlock; /** * Changes the text a text block shows to the given text. * @param inputs - The text block and the text * @returns The same text block * @group set * @shortname set text block text * @example * ```typescript * bitbybit.babylon.gui.textBlock.setText({ textBlock: readout, text: "Radius: 7.5" }); * ``` */ setText(inputs: Inputs.BabylonGui.SetTextBlockTextDto): BABYLON.GUI.TextBlock; /** * Lets a text block grow or shrink to fit its text, when true, instead of keeping its set size. * @param inputs - The text block and the flag * @returns The same text block * @group set * @shortname set resize to fit */ setRsizeToFit(inputs: Inputs.BabylonGui.SetTextBlockResizeToFitDto): BABYLON.GUI.TextBlock; /** * Sets how a text block handles text wider than itself: wrap onto new lines when true, clip * when false, or one of the engine's wrapping modes such as ellipsis. * @param inputs - The text block and the wrapping mode * @returns The same text block * @group set * @shortname set text wrapping */ setTextWrapping(inputs: Inputs.BabylonGui.SetTextBlockTextWrappingDto): BABYLON.GUI.TextBlock; /** * Sets the extra space between the lines of a wrapped text block, as pixels or a string such as * `4px`. * @param inputs - The text block and the line spacing * @returns The same text block * @group set * @shortname set line spacing */ setLineSpacing(inputs: Inputs.BabylonGui.SetTextBlockLineSpacingDto): BABYLON.GUI.TextBlock; /** * Reads the text a text block currently shows. * @param inputs - The text block * @returns The text * @group get * @shortname get text block text */ getText(inputs: Inputs.BabylonGui.TextBlockDto): string; /** * Reads how a text block handles text wider than itself. * @param inputs - The text block * @returns The wrapping mode * @group get * @shortname get text wrapping */ getTextWrapping(inputs: Inputs.BabylonGui.TextBlockDto): boolean | BABYLON.GUI.TextWrapping; /** * Reads the extra space between the lines of a text block. * @param inputs - The text block * @returns The line spacing * @group get * @shortname get line spacing */ getLineSpacing(inputs: Inputs.BabylonGui.TextBlockDto): string | number; /** * Reads the width of the outline around a text block's letters, 0 meaning none. * @param inputs - The text block * @returns The outline width * @group get * @shortname get outline width */ getOutlineWidth(inputs: Inputs.BabylonGui.TextBlockDto): number; /** * Reads whether a text block resizes itself to fit its text. * @param inputs - The text block * @returns True when it resizes to fit * @group get * @shortname get resize to fit */ getResizeToFit(inputs: Inputs.BabylonGui.TextBlockDto): boolean; /** * Reads where the text sits horizontally in its block, as the engine's number for left, center * or right. * @param inputs - The text block * @returns The horizontal alignment code * @group get * @shortname get text horizontal alignment */ getTextHorizontalAlignment(inputs: Inputs.BabylonGui.TextBlockDto): number; /** * Reads where the text sits vertically in its block, as the engine's number for top, center or * bottom. * @param inputs - The text block * @returns The vertical alignment code * @group get * @shortname get text vertical alignment */ getTextVerticalAlignment(inputs: Inputs.BabylonGui.TextBlockDto): number; /** * Passes through the name of a text block event, its text changing, as a typed selector for * code that subscribes to text block events by name. * @param inputs - The event selector * @returns The same selector * @group create * @shortname text block observable selector */ createTextBlockObservableSelector(inputs: Inputs.BabylonGui.TextBlockObservableSelectorDto): Inputs.BabylonGui.textBlockObservableSelectorEnum; }