@playcanvas/web-components
Version:
Web Components for the PlayCanvas Engine
158 lines (157 loc) • 4.48 kB
TypeScript
import { Color, ElementComponent, Vec2, Vec4 } from 'playcanvas';
import { ComponentElement } from './component';
/**
* The ElementComponentElement interface provides properties and methods for manipulating
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-element/ | `<pc-element>`} elements.
* The ElementComponentElement interface also inherits the properties and methods of the
* {@link HTMLElement} interface.
*
* @category Components
*/
declare class ElementComponentElement extends ComponentElement {
private _anchor;
private _asset;
private _autoWidth;
private _color;
private _fontSize;
private _lineHeight;
private _pivot;
private _text;
private _type;
private _width;
private _wrapLines;
/** @ignore */
constructor();
initComponent(): void;
getInitialComponentData(): {
anchor: Vec4;
autoWidth: boolean;
color: Color;
fontAsset: number;
fontSize: number;
lineHeight: number;
pivot: Vec2;
type: "text" | "image" | "group";
text: string;
width: number;
wrapLines: boolean;
};
/**
* Gets the underlying PlayCanvas element component.
* @returns The element component.
*/
get component(): ElementComponent | null;
/**
* Sets the anchor of the element component.
* @param value - The anchor.
*/
set anchor(value: Vec4);
/**
* Gets the anchor of the element component.
* @returns The anchor.
*/
get anchor(): Vec4;
/**
* Sets the id of the `pc-asset` to use for the font.
* @param value - The asset ID.
*/
set asset(value: string);
/**
* Gets the id of the `pc-asset` to use for the font.
* @returns The asset ID.
*/
get asset(): string;
/**
* Sets whether the element component should automatically adjust its width.
* @param value - Whether to automatically adjust the width.
*/
set autoWidth(value: boolean);
/**
* Gets whether the element component should automatically adjust its width.
* @returns Whether to automatically adjust the width.
*/
get autoWidth(): boolean;
/**
* Sets the color of the element component.
* @param value - The color.
*/
set color(value: Color);
/**
* Gets the color of the element component.
* @returns The color.
*/
get color(): Color;
/**
* Sets the font size of the element component.
* @param value - The font size.
*/
set fontSize(value: number);
/**
* Gets the font size of the element component.
* @returns The font size.
*/
get fontSize(): number;
/**
* Sets the line height of the element component.
* @param value - The line height.
*/
set lineHeight(value: number);
/**
* Gets the line height of the element component.
* @returns The line height.
*/
get lineHeight(): number;
/**
* Sets the pivot of the element component.
* @param value - The pivot.
*/
set pivot(value: Vec2);
/**
* Gets the pivot of the element component.
* @returns The pivot.
*/
get pivot(): Vec2;
/**
* Sets the text of the element component.
* @param value - The text.
*/
set text(value: string);
/**
* Gets the text of the element component.
* @returns The text.
*/
get text(): string;
/**
* Sets the type of the element component.
* @param value - The type.
*/
set type(value: 'group' | 'image' | 'text');
/**
* Gets the type of the element component.
* @returns The type.
*/
get type(): 'group' | 'image' | 'text';
/**
* Sets the width of the element component.
* @param value - The width.
*/
set width(value: number);
/**
* Gets the width of the element component.
* @returns The width.
*/
get width(): number;
/**
* Sets whether the element component should wrap lines.
* @param value - Whether to wrap lines.
*/
set wrapLines(value: boolean);
/**
* Gets whether the element component should wrap lines.
* @returns Whether to wrap lines.
*/
get wrapLines(): boolean;
static get observedAttributes(): string[];
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
}
export { ElementComponentElement };