Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Container

Root class for 2D containers

see

https://doc.babylonjs.com/how_to/gui#containers

Hierarchy

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • new Container(name?: string | undefined): Container
  • Creates a new Container

    Parameters

    • Optional name: string | undefined

      defines the name of the container

    Returns Container

Properties

clipChildrenSearch playground for clipChildren

clipChildren: boolean

Gets or sets 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

clipContentSearch playground for clipContent

clipContent: boolean

Gets or sets a boolean indicating that control content must be clipped 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

fixedRatioSearch playground for fixedRatio

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

hoverCursorSearch playground for hoverCursor

hoverCursor: string

Gets or sets the cursor to use when the control is hovered

isFocusInvisibleSearch playground for isFocusInvisible

isFocusInvisible: boolean

Gets or sets a boolean indicating if the control can be focusable

isHitTestVisibleSearch playground for isHitTestVisible

isHitTestVisible: boolean

Gets or sets a boolean indicating if the control can be hit with pointer events

isPointerBlockerSearch playground for isPointerBlocker

isPointerBlocker: boolean

Gets or sets a boolean indicating if the control can block pointer events

logLayoutCycleErrorsSearch playground for logLayoutCycleErrors

logLayoutCycleErrors: boolean

Gets or sets a boolean indicating that layout cycle errors should be displayed on the console

maxLayoutCycleSearch playground for maxLayoutCycle

maxLayoutCycle: number

Gets or sets the number of layout cycles (a change involved by a control while evaluating the layout) allowed

metadataSearch playground for metadata

metadata: any

Gets or sets an object used to store user defined information for the node

Optional nameSearch playground for name

name: string | undefined

onAfterDrawObservableSearch playground for onAfterDrawObservable

onAfterDrawObservable: Observable<Control>

An event triggered after the control was drawn

onBeforeDrawObservableSearch playground for onBeforeDrawObservable

onBeforeDrawObservable: Observable<Control>

An event triggered before drawing the control

onDirtyObservableSearch playground for onDirtyObservable

onDirtyObservable: Observable<Control>

An event triggered when the control is marked as dirty

onDisposeObservableSearch playground for onDisposeObservable

onDisposeObservable: Observable<Control>

An event triggered when the control has been disposed

onPointerClickObservableSearch playground for onPointerClickObservable

onPointerClickObservable: Observable<Vector2WithInfo>

An event triggered when a control is clicked on

onPointerDownObservableSearch playground for onPointerDownObservable

onPointerDownObservable: Observable<Vector2WithInfo>

An event triggered when the pointer taps the control

onPointerEnterObservableSearch playground for onPointerEnterObservable

onPointerEnterObservable: Observable<Control>

An event triggered when pointer enters the control

onPointerMoveObservableSearch playground for onPointerMoveObservable

onPointerMoveObservable: Observable<Vector2>

An event triggered when the pointer move over the control.

onPointerOutObservableSearch playground for onPointerOutObservable

onPointerOutObservable: Observable<Control>

An event triggered when the pointer move out of the control.

onPointerUpObservableSearch playground for onPointerUpObservable

onPointerUpObservable: Observable<Vector2WithInfo>

An event triggered when pointer up

onWheelObservableSearch playground for onWheelObservable

onWheelObservable: Observable<Vector2>

An event triggered when pointer wheel is scrolled

parentSearch playground for parent

Gets or sets the control parent

uniqueIdSearch playground for uniqueId

uniqueId: number

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

useBitmapCacheSearch playground for useBitmapCache

useBitmapCache: boolean

Gets or sets a boolean indicating that the current control should cache its rendering (useful when the control does not change often)

Static AllowAlphaInheritanceSearch playground for AllowAlphaInheritance

AllowAlphaInheritance: boolean

Gets or sets a boolean indicating if alpha must be an inherited value (false by default)

Accessors

adaptHeightToChildren

  • get adaptHeightToChildren(): boolean
  • set adaptHeightToChildren(value: boolean): any
  • Gets or sets a boolean indicating if the container should try to adapt to its children height

    Returns boolean

  • Gets or sets a boolean indicating if the container should try to adapt to its children height

    Parameters

    • value: boolean

    Returns any

adaptWidthToChildren

  • get adaptWidthToChildren(): boolean
  • set adaptWidthToChildren(value: boolean): any
  • Gets or sets a boolean indicating if the container should try to adapt to its children width

    Returns boolean

  • Gets or sets a boolean indicating if the container should try to adapt to its children width

    Parameters

    • value: boolean

    Returns any

alpha

  • get alpha(): number
  • set alpha(value: number): any
  • Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent)

    Returns number

  • Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent)

    Parameters

    • value: number

    Returns any

background

  • get background(): string
  • set background(value: string): any
  • Gets or sets background color

    Returns string

  • Gets or sets background color

    Parameters

    • value: string

    Returns any

centerX

  • get centerX(): number
  • Gets the center coordinate on X axis

    Returns number

centerY

  • get centerY(): number
  • Gets the center coordinate on Y axis

    Returns number

children

  • Gets the list of children

    Returns Control[]

color

  • get color(): string
  • set color(value: string): any
  • Gets or sets foreground color

    Returns string

  • Gets or sets foreground color

    Parameters

    • value: string

    Returns any

disabledColor

  • get disabledColor(): string
  • set disabledColor(value: string): any
  • Gets or sets background color of control if it's disabled

    Returns string

  • Gets or sets background color of control if it's disabled

    Parameters

    • value: string

    Returns any

disabledColorItem

  • get disabledColorItem(): string
  • set disabledColorItem(value: string): any
  • Gets or sets front color of control if it's disabled

    Returns string

  • Gets or sets front color of control if it's disabled

    Parameters

    • value: string

    Returns any

fontFamily

  • get fontFamily(): string
  • set fontFamily(value: string): any
  • Gets or set font family

    Returns string

  • Gets or set font family

    Parameters

    • value: string

    Returns any

fontOffset

  • get fontOffset(): { ascent: number; descent: number; height: number }
  • set fontOffset(offset: { ascent: number; descent: number; height: number }): any
  • Gets or set information about font offsets (used to render and align text)

    Returns { ascent: number; descent: number; height: number }

    • ascent: number
    • descent: number
    • height: number
  • Gets or set information about font offsets (used to render and align text)

    Parameters

    • offset: { ascent: number; descent: number; height: number }
      • ascent: number
      • descent: number
      • height: number

    Returns any

fontSize

  • get fontSize(): string | number
  • set fontSize(value: string | number): any
  • Gets or sets font size

    Returns string | number

  • Gets or sets font size

    Parameters

    • value: string | number

    Returns any

fontSizeInPixels

  • get fontSizeInPixels(): number
  • set fontSizeInPixels(value: number): any
  • Gets or sets font size in pixels

    Returns number

  • Gets or sets font size in pixels

    Parameters

    • value: number

    Returns any

fontStyle

  • get fontStyle(): string
  • set fontStyle(value: string): any
  • Gets or sets font style

    Returns string

  • Gets or sets font style

    Parameters

    • value: string

    Returns any

fontWeight

  • get fontWeight(): string
  • set fontWeight(value: string): any
  • Gets or sets font weight

    Returns string

  • Gets or sets font weight

    Parameters

    • value: string

    Returns any

height

  • get height(): string | number
  • set height(value: string | number): any

heightInPixels

  • get heightInPixels(): number
  • set heightInPixels(value: number): any

horizontalAlignment

  • get horizontalAlignment(): number
  • set horizontalAlignment(value: number): any

host

isDirty

  • get isDirty(): boolean
  • Gets a boolean indicating that the control needs to update its rendering

    Returns boolean

isEnabled

  • get isEnabled(): boolean
  • set isEnabled(value: boolean): any
  • Gets or sets if control is Enabled

    Returns boolean

  • Gets or sets if control is Enabled

    Parameters

    • value: boolean

    Returns any

isHighlighted

  • get isHighlighted(): boolean
  • set isHighlighted(value: boolean): any
  • Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)

    Returns boolean

  • Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)

    Parameters

    • value: boolean

    Returns any

isVisible

  • get isVisible(): boolean
  • set isVisible(value: boolean): any
  • Gets or sets a boolean indicating if the control is visible

    Returns boolean

  • Gets or sets a boolean indicating if the control is visible

    Parameters

    • value: boolean

    Returns any

left

  • get left(): string | number
  • set left(value: string | number): any

leftInPixels

  • get leftInPixels(): number
  • set leftInPixels(value: number): any

linkOffsetX

  • get linkOffsetX(): string | number
  • set linkOffsetX(value: string | number): any

linkOffsetXInPixels

  • get linkOffsetXInPixels(): number
  • set linkOffsetXInPixels(value: number): any

linkOffsetY

  • get linkOffsetY(): string | number
  • set linkOffsetY(value: string | number): any

linkOffsetYInPixels

  • get linkOffsetYInPixels(): number
  • set linkOffsetYInPixels(value: number): any

linkedMesh

notRenderable

  • get notRenderable(): boolean
  • set notRenderable(value: boolean): any
  • Gets or sets a boolean indicating if the control can be rendered

    Returns boolean

  • Gets or sets a boolean indicating if the control can be rendered

    Parameters

    • value: boolean

    Returns any

paddingBottom

  • get paddingBottom(): string | number
  • set paddingBottom(value: string | number): any

paddingBottomInPixels

  • get paddingBottomInPixels(): number
  • set paddingBottomInPixels(value: number): any

paddingLeft

  • get paddingLeft(): string | number
  • set paddingLeft(value: string | number): any

paddingLeftInPixels

  • get paddingLeftInPixels(): number
  • set paddingLeftInPixels(value: number): any

paddingRight

  • get paddingRight(): string | number
  • set paddingRight(value: string | number): any

paddingRightInPixels

  • get paddingRightInPixels(): number
  • set paddingRightInPixels(value: number): any

paddingTop

  • get paddingTop(): string | number
  • set paddingTop(value: string | number): any

paddingTopInPixels

  • get paddingTopInPixels(): number
  • set paddingTopInPixels(value: number): any

rotation

  • get rotation(): number
  • set rotation(value: number): any

scaleX

  • get scaleX(): number
  • set scaleX(value: number): any

scaleY

  • get scaleY(): number
  • set scaleY(value: number): any

shadowBlur

  • get shadowBlur(): number
  • set shadowBlur(value: number): any
  • Gets or sets a value indicating the amount of blur to use to render the shadow

    Returns number

  • Gets or sets a value indicating the amount of blur to use to render the shadow

    Parameters

    • value: number

    Returns any

shadowColor

  • get shadowColor(): string
  • set shadowColor(value: string): any
  • Gets or sets a value indicating the color of the shadow (black by default ie. "#000")

    Returns string

  • Gets or sets a value indicating the color of the shadow (black by default ie. "#000")

    Parameters

    • value: string

    Returns any

shadowOffsetX

  • get shadowOffsetX(): number
  • set shadowOffsetX(value: number): any
  • Gets or sets a value indicating the offset to apply on X axis to render the shadow

    Returns number

  • Gets or sets a value indicating the offset to apply on X axis to render the shadow

    Parameters

    • value: number

    Returns any

shadowOffsetY

  • get shadowOffsetY(): number
  • set shadowOffsetY(value: number): any
  • Gets or sets a value indicating the offset to apply on Y axis to render the shadow

    Returns number

  • Gets or sets a value indicating the offset to apply on Y axis to render the shadow

    Parameters

    • value: number

    Returns any

style

top

  • get top(): string | number
  • set top(value: string | number): any

topInPixels

  • get topInPixels(): number
  • set topInPixels(value: number): any

transformCenterX

  • get transformCenterX(): number
  • set transformCenterX(value: number): any

transformCenterY

  • get transformCenterY(): number
  • set transformCenterY(value: number): any

typeName

  • get typeName(): string
  • Gets the control type name

    Returns string

verticalAlignment

  • get verticalAlignment(): number
  • set verticalAlignment(value: number): any

width

  • get width(): string | number
  • set width(value: string | number): any

widthInPixels

  • get widthInPixels(): number
  • set widthInPixels(value: number): any

zIndex

  • get zIndex(): number
  • set zIndex(value: number): any
  • Gets or sets z index which is used to reorder controls on the z axis

    Returns number

  • Gets or sets z index which is used to reorder controls on the z axis

    Parameters

    • value: number

    Returns any

Static HORIZONTAL_ALIGNMENT_CENTER

  • get HORIZONTAL_ALIGNMENT_CENTER(): number

Static HORIZONTAL_ALIGNMENT_LEFT

  • get HORIZONTAL_ALIGNMENT_LEFT(): number

Static HORIZONTAL_ALIGNMENT_RIGHT

  • get HORIZONTAL_ALIGNMENT_RIGHT(): number

Static VERTICAL_ALIGNMENT_BOTTOM

  • get VERTICAL_ALIGNMENT_BOTTOM(): number

Static VERTICAL_ALIGNMENT_CENTER

  • get VERTICAL_ALIGNMENT_CENTER(): number

Static VERTICAL_ALIGNMENT_TOP

  • get VERTICAL_ALIGNMENT_TOP(): number

Methods

_flagDescendantsAsMatrixDirtySearch playground for _flagDescendantsAsMatrixDirty

  • _flagDescendantsAsMatrixDirty(): void
  • Returns void

addControlSearch playground for addControl

  • Adds a new control to the current container

    Parameters

    Returns Container

    the current container

clearControlsSearch playground for clearControls

  • Removes all controls from the current container

    Returns Container

    the current container

containsSearch playground for contains

  • contains(x: number, y: number): boolean
  • 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

containsControlSearch playground for containsControl

  • containsControl(control: Control): boolean
  • Search for a specific control in children

    Parameters

    • control: Control

      defines the control to look for

    Returns boolean

    true if the control is in child list

disposeSearch playground for dispose

  • dispose(): void
  • Releases associated resources

    Returns void

getAscendantOfClassSearch playground for getAscendantOfClass

  • 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

getChildByNameSearch playground for getChildByName

  • Gets a child using its name

    Parameters

    • name: string

      defines the child name to look for

    Returns Nullable<Control>

    the child control if found

getChildByTypeSearch playground for getChildByType

  • Gets a child using its type and its name

    Parameters

    • name: string

      defines the child name to look for

    • type: string

      defines the child type to look for

    Returns Nullable<Control>

    the child control if found

getClassNameSearch playground for getClassName

  • getClassName(): string
  • Get the current class name of the control.

    Returns string

    current class name

getDescendantsSearch playground for getDescendants

  • getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[]
  • Will return all controls that have this control as ascendant

    Parameters

    • Optional directDescendantsOnly: boolean

      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

    • Optional predicate: (control: Control) => boolean

      defines 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

        • Parameters

          Returns boolean

    Returns Control[]

    all child controls

getDescendantsToRefSearch playground for getDescendantsToRef

  • getDescendantsToRef(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void
  • Parameters

    • results: Control[]
    • Optional directDescendantsOnly: boolean
    • Optional predicate: (control: Control) => boolean
        • Parameters

          Returns boolean

    Returns void

getLocalCoordinatesSearch playground for getLocalCoordinates

  • Gets coordinates in local control space

    Parameters

    • globalCoordinates: Vector2

      defines the coordinates to transform

    Returns Vector2

    the new coordinates in local space

getLocalCoordinatesToRefSearch playground for getLocalCoordinatesToRef

  • 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

getParentLocalCoordinatesSearch playground for getParentLocalCoordinates

  • Gets coordinates in parent local control space

    Parameters

    • globalCoordinates: Vector2

      defines the coordinates to transform

    Returns Vector2

    the new coordinates in parent local space

isAscendantSearch playground for isAscendant

  • isAscendant(container: Control): boolean
  • 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

linkWithMeshSearch playground for linkWithMesh

moveToVector3Search playground for moveToVector3

  • 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

removeControlSearch playground for removeControl

  • Removes a control from the current container

    Parameters

    • control: Control

      defines the control to remove

    Returns Container

    the current container

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Property
  • Method
  • Static property
  • Static method