Gets whether a text element automatically reduces its font size to fit its height.
Whether the height is auto-fit.
Sets whether a text element should automatically reduce its font size (down to min-font-size)
so the text fits within the element's height. Requires auto-height to be false.
Whether to auto-fit the height.
Gets whether a text element automatically reduces its font size to fit its width.
Whether the width is auto-fit.
Sets whether a text element should automatically reduce its font size (down to min-font-size)
so the text fits within the element's width. Requires auto-width to be false.
Whether to auto-fit the width.
Gets whether the element component should automatically adjust its height.
Whether to automatically adjust the height.
Sets whether the element component should automatically adjust its height to the text content (text elements only).
Whether to automatically adjust the height.
Gets whether the element component should automatically adjust its width.
Whether to automatically adjust the width.
Sets whether the element component should automatically adjust its width to the text content (text elements only).
Whether to automatically adjust the width.
The nearest ancestor <pc-app> element, or null if this element has no <pc-app>
ancestor. The search starts at the parent, so an element never resolves to itself.
The closest app element, or null.
The nearest ancestor element that fronts an entity — <pc-entity>, <pc-model> or
<pc-node> — or null if this element has no such ancestor. The search starts at the
parent, so an element never resolves to itself.
The closest entity-fronting element, or null.
Gets the enabled state of the component.
The enabled state of the component.
Sets the enabled state of the component.
The enabled state of the component.
Gets whether the element component should use markup.
Whether markup is enabled.
Sets whether the element component should use markup.
Whether to enable markup.
Gets the id of the pc-asset to use for the font.
The font asset ID.
Sets the id of the pc-asset to use for the font (text elements).
The font asset ID.
Gets the font size of the element component.
The font size.
Sets the font size of the element component.
The font size.
Gets the height of the element component.
The height.
Sets the height of the element component.
The height.
Gets the line height of the element component.
The line height.
Sets the line height of the element component.
The line height.
Sets the margin of the element component (used to inset the element from stretched anchors).
The margin as a Vec4 (left, bottom, right, top).
Gets whether the element component is a mask.
Whether the element is a mask.
Sets whether the element component is a mask, clipping its descendants to its bounds (image elements only).
Whether the element is a mask.
Gets the largest font size a text element may use when auto-fitting.
The maximum font size.
Sets the largest font size a text element may use when auto-fitting.
The maximum font size.
Gets the smallest font size a text element may use when auto-fitting.
The minimum font size.
Sets the smallest font size a text element may use when auto-fitting.
The minimum font size.
Gets the opacity of the element component.
The opacity.
Sets the opacity of the element component.
The opacity (0 to 1).
Gets the number of pixels per unit used when rendering a sprite.
The pixels per unit.
Sets the number of pixels per unit to use when rendering a sprite (image elements only).
The pixels per unit.
Gets the id of the pc-asset to use for the sprite.
The sprite asset ID.
Sets the id of the pc-asset to use for the sprite (image elements only).
The sprite asset ID.
Gets the frame of the sprite to render.
The sprite frame index.
Sets the frame of the sprite to render (image elements only).
The sprite frame index.
Gets the text of the element component.
The text.
Sets the text of the element component.
The text.
Gets the id of the pc-asset to use for the texture.
The texture asset ID.
Sets the id of the pc-asset to use for the texture (image elements only).
The texture asset ID.
Gets the type of the element component.
The type.
Sets the type of the element component.
The type.
Gets whether the element component accepts input events.
Whether the element accepts input.
Sets whether the element component accepts input events (required for buttons and scrolling).
Whether the element accepts input.
Gets the width of the element component.
The width.
Sets the width of the element component.
The width.
Gets whether the element component should wrap lines.
Whether to wrap lines.
Sets whether the element component should wrap lines.
Whether to wrap lines.
Protected_Called when the element is fully initialized and ready. Subclasses should call this when
they're ready. Resolves the ready promise and dispatches a bubbling, composed ready
event. Signals at most once per readiness cycle: a repeat call before _resetReady
has re-armed the promise does nothing.
Protected_Returns the ready promise to its pending state. Subclasses should call this when the
resource their readiness announced is torn down (typically from disconnectedCallback),
so that a later re-initialization can signal readiness again. Does nothing while the
promise is still pending — an in-flight waiter carries over to the next readiness cycle
rather than being stranded on a promise nothing will ever resolve.
ProtectedgetReturns the data the component is created with. Overridden by subclasses to supply the initial values of their cached properties.
The initial component data.
ProtectedinitConfigures the newly added component. Overridden by subclasses whose setup goes beyond the initial data — child-element handling, asset resolution and the like.
Returns a promise that resolves with this element when it's ready. This is the low-level primitive underlying whenReady, which is the recommended way to wait for elements.
Readiness tracks the element's current lifecycle: once a ready element is torn down (for example by removing it from the document), this returns a fresh promise that resolves when the element is next ready. A promise obtained earlier stays resolved — call this again after re-inserting an element rather than reusing a promise from before its removal.
A promise that resolves with this element when it's ready.
The ElementComponentElement interface provides properties and methods for manipulating
<pc-element>elements. The ElementComponentElement interface also inherits the properties and methods of the HTMLElement interface.Despite the name, this is not a base class or a generic wrapper: it is the engine's 2D UI component, which gives its host entity a rectangle in a
<pc-screen>hierarchy that draws either an image, a line of text or nothing (type="image","text"or"group"). The tag spells the engine component it adds, as every component element does.Engine component: ElementComponent (
element).