Class: UICanvas
WebSG.UICanvas
A UICanvas is used to render UI elements to a flat plane in the world.
Table of contents
Constructors
Properties
Accessors
Methods
Constructors
constructor
• new UICanvas()
Properties
size
• Readonly
size: Vector2
Gets the canvas size as a Vector2 in meters.
Defined in
Accessors
height
• get
height(): number
Gets the canvas height in pixels.
Returns
number
Defined in
• set
height(value
): void
Sets the canvas height in pixels.
Parameters
Name | Type | Description |
---|---|---|
value | number | The canvas height in pixels. |
Returns
void
Defined in
root
• get
root(): undefined
| UIElement
Gets the root UIElement of the canvas.
Returns
undefined
| UIElement
Defined in
• set
root(element
): void
Sets the root UIElement of the canvas.
Parameters
Name | Type | Description |
---|---|---|
element | undefined | UIElement | The root UIElement of the canvas. |
Returns
void
Defined in
width
• get
width(): number
Gets the canvas width in pixels.
Returns
number
Defined in
• set
width(value
): void
Sets the canvas width in pixels.
Parameters
Name | Type | Description |
---|---|---|
value | number | The canvas width in pixels. |
Returns
void
Defined in
Methods
redraw
▸ redraw(): undefined
Redraws the canvas. This should be called any time the UI elements are changed.
Returns
undefined