Class TextBlock
Hierarchy (View Summary)
- Control
- TextBlock
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
Creates a new TextBlock object
Parameters
Optionalname: stringdefines the name of the control
- text: string = ""
defines the text to display (empty string by default)
Returns TextBlock
Properties
adjust Word Wrapping HTML Element
This function will be called when a new HTML element is generated to be used for word wrapping. This is only used when wrapping mode HTML is selected. Using this function you can adjust word-break, overflow-wrap, hyphens, or any other CSS properties of the HTML element, language-dependent.
animations
Array of animations
hover Cursor
Gets or sets the cursor to use when the control is hovered
is Focus Invisible
Gets or sets a boolean indicating if the control can be focusable
is Hit Test Visible
Gets or sets a boolean indicating if the control can be hit with pointer events
is Pointer Blocker
Gets or sets a boolean indicating if the control can block pointer events. False by default except on the following controls:
- Button controls (Button, RadioButton, ToggleButton)
- Checkbox
- ColorPicker
- InputText
- Slider
is Serializable
Indicates if the control should be serialized. Defaults to true.
metadata
Gets or sets an object used to store user defined information for the node
Optionalname
Defines the name of the control
on Accessibility Tag Changed Observable
Observable that fires whenever the accessibility event of the control has changed
on After Draw Observable
An event triggered after the control was drawn
on Before Draw Observable
An event triggered before drawing the control
on Blur Observable
Observable raised when the control loses the focus
on Dirty Observable
An event triggered when the control is marked as dirty
on Dispose Observable
An event triggered when the control has been disposed
on Enabled State Changed Observable
Observable that fires when the control's enabled state changes
on Enter Pressed Observable
An event triggered when a control receives an ENTER key down event
on Focus Observable
Observable raised when the control gets the focus
on Is Visible Changed Observable
An event triggered when the control isVisible is changed
on Keyboard Event Processed Observable
Observable raised when a key event was processed
on Lines Ready Observable
An event triggered after the text was broken up into lines
on Pointer Click Observable
An event triggered when a control is clicked on
on Pointer Down Observable
An event triggered when the pointer taps the control
on Pointer Enter Observable
An event triggered when pointer enters the control
on Pointer Move Observable
An event triggered when the pointer moves over the control.
on Pointer Out Observable
An event triggered when the pointer moves out of the control.
on Pointer Up Observable
An event triggered when pointer up
on Text Changed Observable
An event triggered after the text is changed
on Wheel Observable
An event triggered when pointer wheel is scrolled
Optionaloverlap Delta Multiplier
Gets/sets the deoverlap movement multiplier
Optionaloverlap Group
Gets/sets the overlap group of the control. Controls with overlapGroup set to a number can be deoverlapped. Controls with overlapGroup set to undefined are not deoverlapped.
parent
Gets or sets the control parent
reuse HTML For Word Wrapping
Gets or sets a boolean indicating if the HTML element generated for word wrapping should be reused or removed after each wrapping.
tab Index
The tab index of this control. -1 indicates this control is not part of the tab navigation. A positive value indicates the order of the control in the tab navigation. A value of 0 indicated the control will be focused after all controls with a positive index. More than one control can have the same tab index and the navigation would then go through all controls with the same value in an order defined by the layout or the hierarchy. The value can be changed at any time.
unique Id
Gets or sets the unique id of the node. Please note that this number will be updated when the control is added to a container
use Bitmap Cache
Gets or sets a boolean indicating that the current control should cache its rendering (useful when the control does not change often)
word Splitting Function
Function used to split a string into words. By default, a string is split at each space character found
StaticAdd Header
control: Control,
text: string,
size: string | number,
options: { controlFirst: boolean; isHorizontal: boolean },
) => any = ...
StaticAllow Alpha Inheritance
Gets or sets a boolean indicating if alpha must be an inherited value (false by default)
Accessors
accessibility Tag
-
get accessibilityTag(): Nullable<IAccessibilityTag>
Returns Nullable<IAccessibilityTag>
-
set accessibilityTag(value: Nullable<IAccessibilityTag>): void
Gets or sets the accessibility tag to describe the control for accessibility purpose. By default, GUI controls already indicate accessibility info, but one can override the info using this tag.
Parameters
- value: Nullable<IAccessibilityTag>
Returns void
alpha
-
get alpha(): number
Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent)
Returns number
-
set alpha(value: number): void
Parameters
- value: number
Returns void
apply Outline To Underline
-
get applyOutlineToUnderline(): boolean
If the outline should be applied to the underline/strike-through too. Has different behavior in Edge/Chrome vs Firefox.
Returns boolean
-
set applyOutlineToUnderline(value: boolean): void
Parameters
- value: boolean
Returns void
center X
-
get centerX(): number
Gets the center coordinate on X axis
Returns number
center Y
-
get centerY(): number
Gets the center coordinate on Y axis
Returns number
clip Children
-
get clipChildren(): boolean
Returns boolean
-
set clipChildren(value: boolean): void
Sets/Gets a boolean indicating if the children are clipped to the current control bounds. Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
Parameters
- value: boolean
Returns void
clip Content
-
get clipContent(): boolean
Returns boolean
-
set clipContent(value: boolean): void
Sets/Gets a boolean indicating that control content must be clipped Please note that not clipping content may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
Parameters
- value: boolean
Returns void
color
-
get color(): string
Gets or sets foreground color
Returns string
-
set color(value: string): void
Parameters
- value: string
Returns void
descendants Only Padding
-
get descendantsOnlyPadding(): boolean
Gets or sets a value indicating the padding should work like in CSS. Basically, it will add the padding amount on each side of the parent control for its children.
Returns boolean
-
set descendantsOnlyPadding(value: boolean): void
Parameters
- value: boolean
Returns void
disabled Color
-
get disabledColor(): string
Gets or sets background color of control if it's disabled. Only applies to Button class.
Returns string
-
set disabledColor(value: string): void
Parameters
- value: string
Returns void
disabled Color Item
-
get disabledColorItem(): string
Gets or sets front color of control if it's disabled. Only applies to Checkbox class.
Returns string
-
set disabledColorItem(value: string): void
Parameters
- value: string
Returns void
fixed Ratio
-
get fixedRatio(): number
Gets or sets a fixed ratio for this control. When different from 0, the ratio is used to compute the "second" dimension. The first dimension used in the computation is the last one set (by setting width / widthInPixels or height / heightInPixels), and the second dimension is computed as first dimension * fixedRatio
Returns number
-
set fixedRatio(value: number): void
Parameters
- value: number
Returns void
fixed Ratio Master Is Width
-
get fixedRatioMasterIsWidth(): boolean
Gets or sets a boolean indicating that the fixed ratio is set on the width instead of the height. True by default. When the height of a control is set, this property is changed to false.
Returns boolean
-
set fixedRatioMasterIsWidth(value: boolean): void
Parameters
- value: boolean
Returns void
flex Grow
-
get flexGrow(): number
Gets or sets the nonnegative share of free main-axis space in a FlexPanel.
Returns number
-
set flexGrow(value: number): void
Parameters
- value: number
Returns void
flex Shrink
-
get flexShrink(): number
Gets or sets the nonnegative shrink factor in a FlexPanel, weighted by the declared main-axis size.
Returns number
-
set flexShrink(value: number): void
Parameters
- value: number
Returns void
focused Color
-
get focusedColor(): Nullable<string>
Border color when control is focused When not defined the ADT color will be used. If no ADT color is defined, focused state won't have any border
Returns Nullable<string>
-
set focusedColor(value: Nullable<string>): void
Parameters
- value: Nullable<string>
Returns void
font Family
-
get fontFamily(): string
Gets or set font family
Returns string
-
set fontFamily(value: string): void
Parameters
- value: string
Returns void
font Offset
-
get fontOffset(): { ascent: number; descent: number; height: number }
Gets or set information about font offsets (used to render and align text)
Returns { ascent: number; descent: number; height: number }
-
set fontOffset(
offset: { ascent: number; descent: number; height: number },
): voidParameters
- offset: { ascent: number; descent: number; height: number }
Returns void
font Size
-
get fontSize(): string | number
Gets or sets the font size in px, percent of parent height, em, or rem. For font declarations, em uses the parent font and rem uses the GUI root font. Relative font sizes on the root use the default 18px font, including adaptive scaling.
Returns string | number
-
set fontSize(value: string | number): void
Parameters
- value: string | number
Returns void
font Size In Pixels
-
get fontSizeInPixels(): number
Gets or sets font size in pixels
Returns number
-
set fontSizeInPixels(value: number): void
Parameters
- value: number
Returns void
font Style
-
get fontStyle(): string
Gets or sets font style
Returns string
-
set fontStyle(value: string): void
Parameters
- value: string
Returns void
font Weight
-
get fontWeight(): string
Gets or sets font weight
Returns string
-
set fontWeight(value: string): void
Parameters
- value: string
Returns void
force Resize Width
-
get forceResizeWidth(): boolean
By default, if a text block has text wrapping other than Clip, its width is not resized even if resizeToFit = true. This parameter forces the width to be resized.
Returns boolean
-
set forceResizeWidth(value: boolean): void
Parameters
- value: boolean
Returns void
gradient
-
Gets or sets gradient. Setting a gradient will override the color
Returns Nullable<BaseGradient>
-
Parameters
- value: Nullable<BaseGradient>
Returns void
height
-
get height(): string | number
Gets or sets control height
Returns string | number
-
set height(value: string | number): void
Parameters
- value: string | number
Returns void
height In Pixels
-
get heightInPixels(): number
Gets or sets control height in pixel
Returns number
-
set heightInPixels(value: number): void
Parameters
- value: number
Returns void
highlight Color
-
get highlightColor(): string
Gets or sets a string defining the color to use for highlighting this control
Returns string
-
set highlightColor(value: string): void
Parameters
- value: string
Returns void
highlight Line Width
-
get highlightLineWidth(): number
Gets or sets a number indicating size of stroke we want to highlight the control with (mostly for debugging purpose)
Returns number
-
set highlightLineWidth(value: number): void
Parameters
- value: number
Returns void
horizontal Alignment
-
get horizontalAlignment(): number
Gets or sets the horizontal alignment
Returns number
-
set horizontalAlignment(value: number): void
Parameters
- value: number
Returns void
host
-
Get the hosting AdvancedDynamicTexture
Returns AdvancedDynamicTexture
is Dirty
-
get isDirty(): boolean
Gets a boolean indicating that the control needs to update its rendering
Returns boolean
is Enabled
-
get isEnabled(): boolean
Gets or sets if control is Enabled
Returns boolean
-
set isEnabled(value: boolean): void
Parameters
- value: boolean
Returns void
is Highlighted
-
get isHighlighted(): boolean
Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)
Returns boolean
-
set isHighlighted(value: boolean): void
Parameters
- value: boolean
Returns void
is Read Only
-
get isReadOnly(): boolean
Gets or sets a boolean indicating if the control is readonly (default: false). A readonly control will still raise pointer events but will not react to them
Returns boolean
-
set isReadOnly(value: boolean): void
Parameters
- value: boolean
Returns void
is Visible
-
get isVisible(): boolean
Gets or sets a boolean indicating if the control is visible
Returns boolean
-
set isVisible(value: boolean): void
Parameters
- value: boolean
Returns void
left
-
get left(): string | number
Gets or sets a value indicating the left coordinate of the control
Returns string | number
-
set left(value: string | number): void
Parameters
- value: string | number
Returns void
left In Pixels
-
get leftInPixels(): number
Gets or sets a value indicating the left coordinate in pixels of the control
Returns number
-
set leftInPixels(value: number): void
Parameters
- value: number
Returns void
lines
-
get lines(): any[]
Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
Returns any[]
line Spacing
-
get lineSpacing(): string | number
Gets or sets line spacing value
Returns string | number
-
set lineSpacing(value: string | number): void
Gets or sets line spacing value
Parameters
- value: string | number
Returns void
line Through
-
get lineThrough(): boolean
Gets or sets an boolean indicating that text must be crossed out
Returns boolean
-
set lineThrough(value: boolean): void
Gets or sets an boolean indicating that text must be crossed out
Parameters
- value: boolean
Returns void
linked Mesh
-
get linkedMesh(): Nullable<TransformNode>
Gets the current linked mesh (or null if none)
Returns Nullable<TransformNode>
link Offset X
-
get linkOffsetX(): string | number
Gets or sets a value indicating the offset on X axis to the linked mesh
Returns string | number
-
set linkOffsetX(value: string | number): void
Parameters
- value: string | number
Returns void
link Offset X In Pixels
-
get linkOffsetXInPixels(): number
Gets or sets a value indicating the offset in pixels on X axis to the linked mesh
Returns number
-
set linkOffsetXInPixels(value: number): void
Parameters
- value: number
Returns void
link Offset Y
-
get linkOffsetY(): string | number
Gets or sets a value indicating the offset on Y axis to the linked mesh
Returns string | number
-
set linkOffsetY(value: string | number): void
Parameters
- value: string | number
Returns void
link Offset Y In Pixels
-
get linkOffsetYInPixels(): number
Gets or sets a value indicating the offset in pixels on Y axis to the linked mesh
Returns number
-
set linkOffsetYInPixels(value: number): void
Parameters
- value: number
Returns void
not Renderable
-
get notRenderable(): boolean
Gets or sets a boolean indicating if the control can be rendered
Returns boolean
-
set notRenderable(value: boolean): void
Parameters
- value: boolean
Returns void
outline Color
-
get outlineColor(): string
Gets or sets outlineColor of the text to display
Returns string
-
set outlineColor(value: string): void
Gets or sets outlineColor of the text to display
Parameters
- value: string
Returns void
outline Width
-
get outlineWidth(): number
Gets or sets outlineWidth of the text to display
Returns number
-
set outlineWidth(value: number): void
Gets or sets outlineWidth of the text to display
Parameters
- value: number
Returns void
padding Bottom
-
get paddingBottom(): string | number
Gets or sets a value indicating the padding to use on the bottom of the control
Returns string | number
-
set paddingBottom(value: string | number): void
Parameters
- value: string | number
Returns void
padding Bottom In Pixels
-
get paddingBottomInPixels(): number
Gets or sets a value indicating the padding in pixels to use on the bottom of the control
Returns number
-
set paddingBottomInPixels(value: number): void
Parameters
- value: number
Returns void
padding Left
-
get paddingLeft(): string | number
Gets or sets a value indicating the padding to use on the left of the control
Returns string | number
-
set paddingLeft(value: string | number): void
Parameters
- value: string | number
Returns void
padding Left In Pixels
-
get paddingLeftInPixels(): number
Gets or sets a value indicating the padding in pixels to use on the left of the control
Returns number
-
set paddingLeftInPixels(value: number): void
Parameters
- value: number
Returns void
padding Right
-
get paddingRight(): string | number
Gets or sets a value indicating the padding to use on the right of the control
Returns string | number
-
set paddingRight(value: string | number): void
Parameters
- value: string | number
Returns void
padding Right In Pixels
-
get paddingRightInPixels(): number
Gets or sets a value indicating the padding in pixels to use on the right of the control
Returns number
-
set paddingRightInPixels(value: number): void
Parameters
- value: number
Returns void
padding Top
-
get paddingTop(): string | number
Gets or sets a value indicating the padding to use on the top of the control
Returns string | number
-
set paddingTop(value: string | number): void
Parameters
- value: string | number
Returns void
padding Top In Pixels
-
get paddingTopInPixels(): number
Gets or sets a value indicating the padding in pixels to use on the top of the control
Returns number
-
set paddingTopInPixels(value: number): void
Parameters
- value: number
Returns void
resize To Fit
-
get resizeToFit(): boolean
Gets or sets a boolean indicating that the TextBlock will be resized to fit its content
Returns boolean
-
set resizeToFit(value: boolean): void
Gets or sets a boolean indicating that the TextBlock will be resized to fit its content
Parameters
- value: boolean
Returns void
rotation
-
get rotation(): number
Gets or sets the rotation angle (0 by default)
Returns number
-
set rotation(value: number): void
Parameters
- value: number
Returns void
scale X
-
get scaleX(): number
Gets or sets a value indicating the scale factor on X axis (1 by default)
Returns number
-
set scaleX(value: number): void
Parameters
- value: number
Returns void
scale Y
-
get scaleY(): number
Gets or sets a value indicating the scale factor on Y axis (1 by default)
Returns number
-
set scaleY(value: number): void
Parameters
- value: number
Returns void
shadow Blur
-
get shadowBlur(): number
Gets or sets a value indicating the amount of blur to use to render the shadow
Returns number
-
set shadowBlur(value: number): void
Parameters
- value: number
Returns void
shadow Color
-
get shadowColor(): string
Gets or sets a value indicating the color of the shadow (black by default ie. "#000")
Returns string
-
set shadowColor(value: string): void
Parameters
- value: string
Returns void
shadow Offset X
-
get shadowOffsetX(): number
Gets or sets a value indicating the offset in pixels to apply on X axis to render the shadow
Returns number
-
set shadowOffsetX(value: number): void
Parameters
- value: number
Returns void
shadow Offset Y
-
get shadowOffsetY(): number
Gets or sets a value indicating the offset in pixels to apply on Y axis to render the shadow
Returns number
-
set shadowOffsetY(value: number): void
Parameters
- value: number
Returns void
style
text
-
get text(): string
Gets or sets text to display
Returns string
-
set text(value: string): void
Gets or sets text to display
Parameters
- value: string
Returns void
text Horizontal Alignment
-
get textHorizontalAlignment(): number
Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
Returns number
-
set textHorizontalAlignment(value: number): void
Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
Parameters
- value: number
Returns void
text Vertical Alignment
-
get textVerticalAlignment(): number
Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
Returns number
-
set textVerticalAlignment(value: number): void
Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
Parameters
- value: number
Returns void
text Wrapping
-
Gets or sets a boolean indicating if text must be wrapped
Returns boolean | TextWrapping
-
Gets or sets a boolean indicating if text must be wrapped
Parameters
- value: boolean | TextWrapping
Returns void
top
-
get top(): string | number
Gets or sets a value indicating the top coordinate of the control
Returns string | number
-
set top(value: string | number): void
Parameters
- value: string | number
Returns void
top In Pixels
-
get topInPixels(): number
Gets or sets a value indicating the top coordinate in pixels of the control
Returns number
-
set topInPixels(value: number): void
Parameters
- value: number
Returns void
transform Center X
-
get transformCenterX(): number
Gets or sets the transformation center on X axis (0 by default)
Returns number
-
set transformCenterX(value: number): void
Parameters
- value: number
Returns void
transform Center Y
-
get transformCenterY(): number
Gets or sets the transformation center on Y axis (0 by default)
Returns number
-
set transformCenterY(value: number): void
Parameters
- value: number
Returns void
transformed Measure
-
Gets the transformed measure, that is the bounding box of the control after applying all transformations
Returns Measure
type Name
-
get typeName(): string
Gets the control type name
Returns string
underline
-
get underline(): boolean
Gets or sets a boolean indicating that text must have underline
Returns boolean
-
set underline(value: boolean): void
Gets or sets a boolean indicating that text must have underline
Parameters
- value: boolean
Returns void
vertical Alignment
-
get verticalAlignment(): number
Gets or sets the vertical alignment
Returns number
-
set verticalAlignment(value: number): void
Parameters
- value: number
Returns void
width
-
get width(): string | number
Gets or sets control width
Returns string | number
-
set width(value: string | number): void
Parameters
- value: string | number
Returns void
width In Pixels
-
get widthInPixels(): number
Gets or sets the control width in pixel
Returns number
-
set widthInPixels(value: number): void
Parameters
- value: number
Returns void
word Divider
-
get wordDivider(): string
Gets or sets word divider
Returns string
-
set wordDivider(value: string): void
Gets or sets word divider
Parameters
- value: string
Returns void
z Index
-
get zIndex(): number
Gets or sets z index which is used to reorder controls on the z axis
Returns number
-
set zIndex(value: number): void
Parameters
- value: number
Returns void
StaticHORIZONTAL_ ALIGNMENT_ CENTER
-
get HORIZONTAL_ALIGNMENT_CENTER(): number
HORIZONTAL_ALIGNMENT_CENTER
Returns number
StaticHORIZONTAL_ ALIGNMENT_ LEFT
-
get HORIZONTAL_ALIGNMENT_LEFT(): number
HORIZONTAL_ALIGNMENT_LEFT
Returns number
StaticHORIZONTAL_ ALIGNMENT_ RIGHT
-
get HORIZONTAL_ALIGNMENT_RIGHT(): number
HORIZONTAL_ALIGNMENT_RIGHT
Returns number
StaticVERTICAL_ ALIGNMENT_ BOTTOM
-
get VERTICAL_ALIGNMENT_BOTTOM(): number
VERTICAL_ALIGNMENT_BOTTOM
Returns number
StaticVERTICAL_ ALIGNMENT_ CENTER
-
get VERTICAL_ALIGNMENT_CENTER(): number
VERTICAL_ALIGNMENT_CENTER
Returns number
StaticVERTICAL_ ALIGNMENT_ TOP
-
get VERTICAL_ALIGNMENT_TOP(): number
VERTICAL_ALIGNMENT_TOP
Returns number
Methods
_ on Pointer Pick
-
_onPointerPick(
target: Control,
coordinates: Vector2,
pointerId: number,
buttonIndex: number,
notifyClick: boolean,
pi: Nullable<PointerInfoBase>,
): booleanParameters
- target: Control
- coordinates: Vector2
- pointerId: number
- buttonIndex: number
- notifyClick: boolean
- pi: Nullable<PointerInfoBase>
Returns boolean
blur
-
Function to unfocus a button programmatically
Returns void
clone
-
Clones a control and its descendants
Parameters
Optionalhost: AdvancedDynamicTexturethe texture where the control will be instantiated. Can be empty, in which case the control will be created on the same texture
Returns Control
the cloned control
compute Expected Height
-
Given a width constraint applied on the text block, find the expected height
Returns number
expected height
contains
-
Tests if a given coordinates belong to the current control
Parameters
- x: number
defines x coordinate to test
- y: number
defines y coordinate to test
Returns boolean
true if the coordinates are inside the control
- x: number
dispose
-
Releases associated resources
Returns void
focus
-
Function to focus a button programmatically
Returns void
get Ascendant Of Class
-
Gets the first ascendant in the hierarchy of the given type
Parameters
- className: string
defines the required type
Returns Nullable<Control>
the ascendant or null if not found
- className: string
get Class Name
-
Get the current class name of the control.
Returns string
current class name
get Descendants
-
getDescendants(
directDescendantsOnly?: boolean,
predicate?: (control: Control) => boolean,
): Control[]Will return all controls that have this control as ascendant
Parameters
OptionaldirectDescendantsOnly: booleandefines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
Optionalpredicate: (control: Control) => booleandefines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
Returns Control[]
all child controls
get Descendants To Ref
-
getDescendantsToRef(
results: Control[],
directDescendantsOnly?: boolean,
predicate?: (control: Control) => boolean,
): voidWill store all controls that have this control as ascendant in a given array
Parameters
- results: Control[]
defines the array where to store the descendants
- directDescendantsOnly: boolean = false
defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
Optionalpredicate: (control: Control) => booleandefines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
Returns void
- results: Control[]
get Dimension
-
Gets the dimension of the control along a specified axis
Parameters
- dim: "width" | "height"
the dimension to retrieve (width or height)
Returns ValueAndUnit
the dimension value along the specified axis
- dim: "width" | "height"
get Local Coordinates
-
Gets coordinates in local control space
Parameters
- globalCoordinates: Vector2
defines the coordinates to transform
Returns Vector2
the new coordinates in local space
- globalCoordinates: Vector2
get Local Coordinates To Ref
-
Gets coordinates in local control space
Parameters
- globalCoordinates: Vector2
defines the coordinates to transform
- result: Vector2
defines the target vector2 where to store the result
Returns Control
the current control
- globalCoordinates: Vector2
get Parent Local Coordinates
-
Gets coordinates in parent local control space
Parameters
- globalCoordinates: Vector2
defines the coordinates to transform
Returns Vector2
the new coordinates in parent local space
- globalCoordinates: Vector2
is Ascendant
-
Determines if a container is an ascendant of the current control
Parameters
- container: Control
defines the container to look for
Returns boolean
true if the container is one of the ascendant of the control
- container: Control
is Dimension Fully Defined
-
A control has a dimension fully defined if that dimension doesn't depend on the parent's dimension. As an example, a control that has dimensions in pixels is fully defined, while in percentage is not fully defined.
Parameters
- dim: "width" | "height"
the dimension to check (width or height)
Returns boolean
if the dimension is fully defined
- dim: "width" | "height"
is Ready
-
Returns true if the control is ready to be used
Returns boolean
keeps Focus With
-
Function called to get the list of controls that should not steal the focus from this control
Returns Nullable<Control[]>
an array of controls
link With Mesh
-
Link current control with a target mesh
Parameters
- mesh: Nullable<TransformNode>
defines the mesh to link with
Returns void
- mesh: Nullable<TransformNode>
mark All As Dirty
-
Mark the element and its children as dirty
Returns void
mark As Dirty
-
Mark control element as dirty
Parameters
- force: boolean = false
force non visible elements to be marked too
Returns void
- force: boolean = false
move To Vector3
-
Move the current control to a vector3 position projected onto the screen.
Parameters
- position: Vector3
defines the target position
- scene: Scene
defines the hosting scene
Returns void
- position: Vector3
parse
-
parse(
serializedObject: any,
host?: AdvancedDynamicTexture,
urlRewriter?: (url: string) => string,
): ControlParses a serialized object into this control
Parameters
- serializedObject: any
the object with the serialized properties
Optionalhost: AdvancedDynamicTexturethe texture where the control will be instantiated. Can be empty, in which case the control will be created on the same texture
OptionalurlRewriter: (url: string) => stringdefines an url rewriter to update urls before sending them to the controls
Returns Control
this control
- serializedObject: any
process Keyboard
-
Handles the keyboard event
Parameters
- evt: IKeyboardEvent
Defines the KeyboardEvent
Returns void
- evt: IKeyboardEvent
serialize
-
Serializes the current control
Parameters
- serializationObject: any
defined the JSON serialized object
- force: boolean = false
if the control should be serialized even if the isSerializable flag is set to false (default false)
- allowCanvas: boolean = true
defines if the control is allowed to use a Canvas2D object to serialize (true by default)
Returns void
- serializationObject: any
set Padding
-
setPadding(
paddingTop: string | number,
paddingRight?: string | number,
paddingBottom?: string | number,
paddingLeft?: string | number,
): voidShorthand function to set the top, right, bottom, and left padding values on the control.
Parameters
- paddingTop: string | number
The value of the top padding.
OptionalpaddingRight: string | numberThe value of the right padding. If omitted, top is used.
OptionalpaddingBottom: string | numberThe value of the bottom padding. If omitted, top is used.
OptionalpaddingLeft: string | numberThe value of the left padding. If omitted, right is used.
Returns void
- paddingTop: string | number
set Padding In Pixels
-
setPaddingInPixels(
paddingTop: number,
paddingRight?: number,
paddingBottom?: number,
paddingLeft?: number,
): voidShorthand funtion to set the top, right, bottom, and left padding values in pixels on the control.
Parameters
- paddingTop: number
The value in pixels of the top padding.
OptionalpaddingRight: numberThe value in pixels of the right padding. If omitted, top is used.
OptionalpaddingBottom: numberThe value in pixels of the bottom padding. If omitted, top is used.
OptionalpaddingLeft: numberThe value in pixels of the left padding. If omitted, right is used.
Returns void
- paddingTop: number
StaticParse
-
Parse(
serializedObject: any,
host: AdvancedDynamicTexture,
urlRewriter?: (url: string) => string,
): ControlCreates a Control from parsed data
Parameters
- serializedObject: any
defines parsed data
- host: AdvancedDynamicTexture
defines the hosting AdvancedDynamicTexture
OptionalurlRewriter: (url: string) => stringdefines an url rewriter to update urls before sending them to the controls
Returns Control
a new Control
- serializedObject: any
Class used to create text block control