Class Button
Hierarchy
-
Rectangle
- Button
Index
Constructors
Properties
- clip
Children - clip
Content - delegate
Picking ToChildren - fixed
Ratio - hover
Cursor - is
Focus Invisible - is
Hit Test Visible - is
Pointer Blocker - log
Layout Cycle Errors - max
Layout Cycle - metadata
- name
- on
After Draw Observable - on
Before Draw Observable - on
Dirty Observable - on
Dispose Observable - on
Pointer Click Observable - on
Pointer Down Observable - on
Pointer Enter Observable - on
Pointer Move Observable - on
Pointer Out Observable - on
Pointer UpObservable - on
Wheel Observable - parent
- pointer
Down Animation - pointer
Enter Animation - pointer
Out Animation - pointer
UpAnimation - unique
Id - use
Bitmap Cache - Allow
Alpha Inheritance
Accessors
- adapt
Height ToChildren - adapt
Width ToChildren - alpha
- background
- centerX
- centerY
- children
- color
- corner
Radius - disabled
Color - disabled
Color Item - font
Family - font
Offset - font
Size - font
Size InPixels - font
Style - font
Weight - height
- height
InPixels - horizontal
Alignment - host
- image
- is
Dirty - is
Enabled - is
Highlighted - is
Visible - left
- left
InPixels - link
OffsetX - link
OffsetXIn Pixels - link
OffsetY - link
OffsetYIn Pixels - linked
Mesh - not
Renderable - padding
Bottom - padding
Bottom InPixels - padding
Left - padding
Left InPixels - padding
Right - padding
Right InPixels - padding
Top - padding
Top InPixels - rotation
- scaleX
- scaleY
- shadow
Blur - shadow
Color - shadow
OffsetX - shadow
OffsetY - style
- text
Block - thickness
- top
- top
InPixels - transform
CenterX - transform
CenterY - type
Name - vertical
Alignment - width
- width
InPixels - z
Index - HORIZONTAL_
ALIGNMENT_ CENTER - HORIZONTAL_
ALIGNMENT_ LEFT - HORIZONTAL_
ALIGNMENT_ RIGHT - VERTICAL_
ALIGNMENT_ BOTTOM - VERTICAL_
ALIGNMENT_ CENTER - VERTICAL_
ALIGNMENT_ TOP
Methods
- _flag
Descendants AsMatrix Dirty - add
Control - clear
Controls - contains
- contains
Control - dispose
- get
Ascendant OfClass - get
Child ByName - get
Child ByType - get
Class Name - get
Descendants - get
Descendants ToRef - get
Local Coordinates - get
Local Coordinates ToRef - get
Parent Local Coordinates - is
Ascendant - link
With Mesh - move
ToVector3 - remove
Control - serialize
- set
Padding - set
Padding InPixels - Create
Image Button - Create
Image Only Button - Create
Image With Center Text Button - Create
Simple Button - Parse
Constructors
constructor
-
Creates a new Button
Parameters
-
Optional name: string | undefined
defines the name of the button
Returns Button
-
Properties
clip ChildrenSearch playground for clipChildren
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
clip ContentSearch playground for clipContent
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
delegate Picking ToChildrenSearch playground for delegatePickingToChildren
Gets or sets a boolean indicating that the button will let internal controls handle picking instead of doing it directly using its bounding info
fixed RatioSearch playground for fixedRatio
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
hover CursorSearch playground for hoverCursor
Gets or sets the cursor to use when the control is hovered
is Focus InvisibleSearch playground for isFocusInvisible
Gets or sets a boolean indicating if the control can be focusable
is Hit Test VisibleSearch playground for isHitTestVisible
Gets or sets a boolean indicating if the control can be hit with pointer events
is Pointer BlockerSearch playground for isPointerBlocker
Gets or sets a boolean indicating if the control can block pointer events
log Layout Cycle ErrorsSearch playground for logLayoutCycleErrors
Gets or sets a boolean indicating that layout cycle errors should be displayed on the console
max Layout CycleSearch playground for maxLayoutCycle
Gets or sets the number of layout cycles (a change involved by a control while evaluating the layout) allowed
metadataSearch playground for metadata
Gets or sets an object used to store user defined information for the node
Optional nameSearch playground for name
on After Draw ObservableSearch playground for onAfterDrawObservable
An event triggered after the control was drawn
on Before Draw ObservableSearch playground for onBeforeDrawObservable
An event triggered before drawing the control
on Dirty ObservableSearch playground for onDirtyObservable
An event triggered when the control is marked as dirty
on Dispose ObservableSearch playground for onDisposeObservable
An event triggered when the control has been disposed
on Pointer Click ObservableSearch playground for onPointerClickObservable
An event triggered when a control is clicked on
on Pointer Down ObservableSearch playground for onPointerDownObservable
An event triggered when the pointer taps the control
on Pointer Enter ObservableSearch playground for onPointerEnterObservable
An event triggered when pointer enters the control
on Pointer Move ObservableSearch playground for onPointerMoveObservable
An event triggered when the pointer move over the control.
on Pointer Out ObservableSearch playground for onPointerOutObservable
An event triggered when the pointer move out of the control.
on Pointer UpObservableSearch playground for onPointerUpObservable
An event triggered when pointer up
on Wheel ObservableSearch playground for onWheelObservable
An event triggered when pointer wheel is scrolled
parentSearch playground for parent
Gets or sets the control parent
pointer Down AnimationSearch playground for pointerDownAnimation
Function called to generate a pointer down animation
Type declaration
-
-
Returns void
-
pointer Enter AnimationSearch playground for pointerEnterAnimation
Function called to generate a pointer enter animation
Type declaration
-
-
Returns void
-
pointer Out AnimationSearch playground for pointerOutAnimation
Function called to generate a pointer out animation
Type declaration
-
-
Returns void
-
pointer UpAnimationSearch playground for pointerUpAnimation
Function called to generate a pointer up animation
Type declaration
-
-
Returns void
-
unique IdSearch playground for uniqueId
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 CacheSearch playground for useBitmapCache
Gets or sets a boolean indicating that the current control should cache its rendering (useful when the control does not change often)
Static Allow Alpha InheritanceSearch playground for AllowAlphaInheritance
Gets or sets a boolean indicating if alpha must be an inherited value (false by default)
Accessors
adapt Height ToChildren
-
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
-
adapt Width ToChildren
-
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
-
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
-
Gets or sets background color
Returns string
-
Gets or sets background color
Parameters
-
value: string
Returns any
-
centerX
-
Gets the center coordinate on X axis
Returns number
centerY
-
Gets the center coordinate on Y axis
Returns number
children
-
Gets the list of children
Returns Control[]
color
-
Gets or sets foreground color
Returns string
-
Gets or sets foreground color
Parameters
-
value: string
Returns any
-
corner Radius
-
Gets or sets the corner radius angle
Returns number
-
Gets or sets the corner radius angle
Parameters
-
value: number
Returns any
-
disabled Color
-
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
-
disabled Color Item
-
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
-
font Family
-
Gets or set font family
Returns string
-
Gets or set font family
Parameters
-
value: string
Returns any
-
font Offset
-
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
-
font Size
-
Gets or sets font size
Returns string | number
-
Gets or sets font size
Parameters
-
value: string | number
Returns any
-
font Size InPixels
-
Gets or sets font size in pixels
Returns number
-
Gets or sets font size in pixels
Parameters
-
value: number
Returns any
-
font Style
-
Gets or sets font style
Returns string
-
Gets or sets font style
Parameters
-
value: string
Returns any
-
font Weight
-
Gets or sets font weight
Returns string
-
Gets or sets font weight
Parameters
-
value: string
Returns any
-
height
-
Gets or sets control height
Returns string | number
-
Gets or sets control height
Parameters
-
value: string | number
Returns any
-
height InPixels
-
Gets or sets control height in pixel
Returns number
-
Gets or sets control height in pixel
Parameters
-
value: number
Returns any
-
horizontal Alignment
-
Gets or sets the horizontal alignment
Returns number
-
Gets or sets the horizontal alignment
Parameters
-
value: number
Returns any
-
host
-
Get the hosting AdvancedDynamicTexture
Returns AdvancedDynamicTexture
image
is Dirty
-
Gets a boolean indicating that the control needs to update its rendering
Returns boolean
is Enabled
-
Gets or sets if control is Enabled
Returns boolean
-
Gets or sets if control is Enabled
Parameters
-
value: boolean
Returns any
-
is Highlighted
-
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
-
is Visible
-
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
-
Gets or sets a value indicating the left coordinate of the control
Returns string | number
-
Gets or sets a value indicating the left coordinate of the control
Parameters
-
value: string | number
Returns any
-
left InPixels
-
Gets or sets a value indicating the left coordinate in pixels of the control
Returns number
-
Gets or sets a value indicating the left coordinate in pixels of the control
Parameters
-
value: number
Returns any
-
link OffsetX
-
Gets or sets a value indicating the offset on X axis to the linked mesh
Returns string | number
-
Gets or sets a value indicating the offset on X axis to the linked mesh
Parameters
-
value: string | number
Returns any
-
link OffsetXIn Pixels
-
Gets or sets a value indicating the offset in pixels on X axis to the linked mesh
Returns number
-
Gets or sets a value indicating the offset in pixels on X axis to the linked mesh
Parameters
-
value: number
Returns any
-
link OffsetY
-
Gets or sets a value indicating the offset on Y axis to the linked mesh
Returns string | number
-
Gets or sets a value indicating the offset on Y axis to the linked mesh
Parameters
-
value: string | number
Returns any
-
link OffsetYIn Pixels
-
Gets or sets a value indicating the offset in pixels on Y axis to the linked mesh
Returns number
-
Gets or sets a value indicating the offset in pixels on Y axis to the linked mesh
Parameters
-
value: number
Returns any
-
linked Mesh
-
Gets the current linked mesh (or null if none)
Returns Nullable<TransformNode>
not Renderable
-
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
-
padding Bottom
-
Gets or sets a value indicating the padding to use on the bottom of the control
Returns string | number
-
Gets or sets a value indicating the padding to use on the bottom of the control
Parameters
-
value: string | number
Returns any
-
padding Bottom InPixels
-
Gets or sets a value indicating the padding in pixels to use on the bottom of the control
Returns number
-
Gets or sets a value indicating the padding in pixels to use on the bottom of the control
Parameters
-
value: number
Returns any
-
padding Left
-
Gets or sets a value indicating the padding to use on the left of the control
Returns string | number
-
Gets or sets a value indicating the padding to use on the left of the control
Parameters
-
value: string | number
Returns any
-
padding Left InPixels
-
Gets or sets a value indicating the padding in pixels to use on the left of the control
Returns number
-
Gets or sets a value indicating the padding in pixels to use on the left of the control
Parameters
-
value: number
Returns any
-
padding Right
-
Gets or sets a value indicating the padding to use on the right of the control
Returns string | number
-
Gets or sets a value indicating the padding to use on the right of the control
Parameters
-
value: string | number
Returns any
-
padding Right InPixels
-
Gets or sets a value indicating the padding in pixels to use on the right of the control
Returns number
-
Gets or sets a value indicating the padding in pixels to use on the right of the control
Parameters
-
value: number
Returns any
-
padding Top
-
Gets or sets a value indicating the padding to use on the top of the control
Returns string | number
-
Gets or sets a value indicating the padding to use on the top of the control
Parameters
-
value: string | number
Returns any
-
padding Top InPixels
-
Gets or sets a value indicating the padding in pixels to use on the top of the control
Returns number
-
Gets or sets a value indicating the padding in pixels to use on the top of the control
Parameters
-
value: number
Returns any
-
rotation
-
Gets or sets the rotation angle (0 by default)
Returns number
-
Gets or sets the rotation angle (0 by default)
Parameters
-
value: number
Returns any
-
scaleX
-
Gets or sets a value indicating the scale factor on X axis (1 by default)
Returns number
-
Gets or sets a value indicating the scale factor on X axis (1 by default)
Parameters
-
value: number
Returns any
-
scaleY
-
Gets or sets a value indicating the scale factor on Y axis (1 by default)
Returns number
-
Gets or sets a value indicating the scale factor on Y axis (1 by default)
Parameters
-
value: number
Returns any
-
shadow Blur
-
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
-
shadow Color
-
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
-
shadow OffsetX
-
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
-
shadow OffsetY
-
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
text Block
thickness
-
Gets or sets border thickness
Returns number
-
Gets or sets border thickness
Parameters
-
value: number
Returns any
-
top
-
Gets or sets a value indicating the top coordinate of the control
Returns string | number
-
Gets or sets a value indicating the top coordinate of the control
Parameters
-
value: string | number
Returns any
-
top InPixels
-
Gets or sets a value indicating the top coordinate in pixels of the control
Returns number
-
Gets or sets a value indicating the top coordinate in pixels of the control
Parameters
-
value: number
Returns any
-
transform CenterX
-
Gets or sets the transformation center on X axis (0 by default)
Returns number
-
Gets or sets the transformation center on X axis (0 by default)
Parameters
-
value: number
Returns any
-
transform CenterY
-
Gets or sets the transformation center on Y axis (0 by default)
Returns number
-
Gets or sets the transformation center on Y axis (0 by default)
Parameters
-
value: number
Returns any
-
type Name
-
Gets the control type name
Returns string
vertical Alignment
-
Gets or sets the vertical alignment
Returns number
-
Gets or sets the vertical alignment
Parameters
-
value: number
Returns any
-
width
-
Gets or sets control width
Returns string | number
-
Gets or sets control width
Parameters
-
value: string | number
Returns any
-
width InPixels
-
Gets or sets the control width in pixel
Returns number
-
Gets or sets the control width in pixel
Parameters
-
value: number
Returns any
-
z Index
-
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
-
HORIZONTAL_ALIGNMENT_CENTER
Returns number
Static HORIZONTAL_ ALIGNMENT_ LEFT
-
HORIZONTAL_ALIGNMENT_LEFT
Returns number
Static HORIZONTAL_ ALIGNMENT_ RIGHT
-
HORIZONTAL_ALIGNMENT_RIGHT
Returns number
Static VERTICAL_ ALIGNMENT_ BOTTOM
-
VERTICAL_ALIGNMENT_BOTTOM
Returns number
Static VERTICAL_ ALIGNMENT_ CENTER
-
VERTICAL_ALIGNMENT_CENTER
Returns number
Static VERTICAL_ ALIGNMENT_ TOP
-
VERTICAL_ALIGNMENT_TOP
Returns number
Methods
_flag Descendants AsMatrix DirtySearch playground for _flagDescendantsAsMatrixDirty
-
Returns void
add ControlSearch playground for addControl
clear ControlsSearch playground for clearControls
-
Removes all controls from the current container
Returns Container
the current container
containsSearch playground for 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
-
contains ControlSearch playground for containsControl
-
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
-
Releases associated resources
Returns void
get Ascendant OfClassSearch playground for getAscendantOfClass
get Child ByNameSearch playground for getChildByName
get Child ByTypeSearch playground for getChildByType
get Class NameSearch playground for getClassName
-
Get the current class name of the control.
Returns string
current class name
get DescendantsSearch playground for getDescendants
-
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
-
control: Control
Returns boolean
-
-
-
Returns Control[]
all child controls
-
get Descendants ToRefSearch playground for getDescendantsToRef
get Local CoordinatesSearch playground for getLocalCoordinates
get Local Coordinates ToRefSearch playground for getLocalCoordinatesToRef
get Parent Local CoordinatesSearch playground for getParentLocalCoordinates
is AscendantSearch playground for isAscendant
-
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
-
link With MeshSearch playground for linkWithMesh
-
Link current control with a target mesh
Parameters
-
mesh: Nullable<TransformNode>
defines the mesh to link with
Returns void
-
move ToVector3Search playground for moveToVector3
remove ControlSearch playground for removeControl
serializeSearch playground for serialize
-
Serializes the current control
Parameters
-
serializationObject: any
defined the JSON serialized object
Returns void
-
set PaddingSearch playground for setPadding
-
Shorthand funtion to set the top, right, bottom, and left padding values on the control.
Parameters
-
paddingTop: string | number
The value of the top padding.
-
Optional paddingRight: string | number
The value of the right padding. If omitted, top is used.
-
Optional paddingBottom: string | number
The value of the bottom padding. If omitted, top is used.
-
Optional paddingLeft: string | number
The value of the left padding. If omitted, right is used.
Returns void
-
set Padding InPixelsSearch playground for setPaddingInPixels
-
Shorthand 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.
-
Optional paddingRight: number
The value in pixels of the right padding. If omitted, top is used.
-
Optional paddingBottom: number
The value in pixels of the bottom padding. If omitted, top is used.
-
Optional paddingLeft: number
The value in pixels of the left padding. If omitted, right is used.
Returns void
-
Static Create Image ButtonSearch playground for CreateImageButton
-
Creates a new button made with an image and a text
Parameters
-
name: string
defines the name of the button
-
text: string
defines the text of the button
-
imageUrl: string
defines the url of the image
Returns Button
a new Button
-
Static Create Image Only ButtonSearch playground for CreateImageOnlyButton
-
Creates a new button made with an image
Parameters
-
name: string
defines the name of the button
-
imageUrl: string
defines the url of the image
Returns Button
a new Button
-
Static Create Image With Center Text ButtonSearch playground for CreateImageWithCenterTextButton
-
Creates a new button made with an image and a centered text
Parameters
-
name: string
defines the name of the button
-
text: string
defines the text of the button
-
imageUrl: string
defines the url of the image
Returns Button
a new Button
-
Static Create Simple ButtonSearch playground for CreateSimpleButton
-
Creates a new button made with a text
Parameters
-
name: string
defines the name of the button
-
text: string
defines the text of the button
Returns Button
a new Button
-
Static ParseSearch playground for Parse
-
Creates a Control from parsed data
Parameters
-
serializedObject: any
defines parsed data
-
host: AdvancedDynamicTexture
defines the hosting AdvancedDynamicTexture
Returns Control
a new Control
-
Class used to create 2D buttons