Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/camera-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class CameraComponentElement extends ComponentElement {
}

/**
* Gets the camera component.
* Gets the underlying PlayCanvas camera component.
* @returns The camera component.
*/
get component(): CameraComponent | null {
Expand Down
2 changes: 1 addition & 1 deletion src/components/collision-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class CollisionComponentElement extends ComponentElement {
}

/**
* Gets the collision component.
* Gets the underlying PlayCanvas collision component.
* @returns The collision component.
*/
get component(): CollisionComponent | null {
Expand Down
82 changes: 81 additions & 1 deletion src/components/element-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,36 @@ class ElementComponentElement extends ComponentElement {
}

/**
* Gets the element component.
* Gets the underlying PlayCanvas element component.
* @returns The element component.
*/
get component(): ElementComponent | null {
return super.component as ElementComponent | null;
}

/**
* Sets the anchor of the element component.
* @param value - The anchor.
*/
set anchor(value: Vec4) {
this._anchor = value;
if (this.component) {
this.component.anchor = value;
}
}

/**
* Gets the anchor of the element component.
* @returns The anchor.
*/
get anchor() {
return this._anchor;
}

/**
* Sets the id of the `pc-asset` to use for the font.
* @param value - The asset ID.
*/
set asset(value: string) {
this._asset = value;
const asset = AssetElement.get(value);
Expand All @@ -86,72 +98,124 @@ class ElementComponentElement extends ComponentElement {
}
}

/**
* Gets the id of the `pc-asset` to use for the font.
* @returns The asset ID.
*/
get asset() {
return this._asset;
}

/**
* Sets whether the element component should automatically adjust its width.
* @param value - Whether to automatically adjust the width.
*/
set autoWidth(value: boolean) {
this._autoWidth = value;
if (this.component) {
this.component.autoWidth = value;
}
}

/**
* Gets whether the element component should automatically adjust its width.
* @returns Whether to automatically adjust the width.
*/
get autoWidth() {
return this._autoWidth;
}

/**
* Sets the color of the element component.
* @param value - The color.
*/
set color(value: Color) {
this._color = value;
if (this.component) {
this.component.color = value;
}
}

/**
* Gets the color of the element component.
* @returns The color.
*/
get color() {
return this._color;
}

/**
* Sets the font size of the element component.
* @param value - The font size.
*/
set fontSize(value: number) {
this._fontSize = value;
if (this.component) {
this.component.fontSize = value;
}
}

/**
* Gets the font size of the element component.
* @returns The font size.
*/
get fontSize() {
return this._fontSize;
}

/**
* Sets the line height of the element component.
* @param value - The line height.
*/
set lineHeight(value: number) {
this._lineHeight = value;
if (this.component) {
this.component.lineHeight = value;
}
}

/**
* Gets the line height of the element component.
* @returns The line height.
*/
get lineHeight() {
return this._lineHeight;
}

/**
* Sets the pivot of the element component.
* @param value - The pivot.
*/
set pivot(value: Vec2) {
this._pivot = value;
if (this.component) {
this.component.pivot = value;
}
}

/**
* Gets the pivot of the element component.
* @returns The pivot.
*/
get pivot() {
return this._pivot;
}

/**
* Sets the text of the element component.
* @param value - The text.
*/
set text(value: string) {
this._text = value;
if (this.component) {
this.component.text = value;
}
}

/**
* Gets the text of the element component.
* @returns The text.
*/
get text() {
return this._text;
}
Expand All @@ -175,24 +239,40 @@ class ElementComponentElement extends ComponentElement {
return this._type;
}

/**
* Sets the width of the element component.
* @param value - The width.
*/
set width(value: number) {
this._width = value;
if (this.component) {
this.component.width = value;
}
}

/**
* Gets the width of the element component.
* @returns The width.
*/
get width() {
return this._width;
}

/**
* Sets whether the element component should wrap lines.
* @param value - Whether to wrap lines.
*/
set wrapLines(value: boolean) {
this._wrapLines = value;
if (this.component) {
this.component.wrapLines = value;
}
}

/**
* Gets whether the element component should wrap lines.
* @returns Whether to wrap lines.
*/
get wrapLines() {
return this._wrapLines;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/light-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class LightComponentElement extends ComponentElement {
}

/**
* Gets the light component.
* Gets the underlying PlayCanvas light component.
* @returns The light component.
*/
get component(): LightComponent | null {
Expand Down
2 changes: 1 addition & 1 deletion src/components/listener-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ListenerComponentElement extends ComponentElement {
}

/**
* Gets the audio listener component.
* Gets the underlying PlayCanvas audio listener component.
* @returns The audio listener component.
*/
get component(): AudioListenerComponent | null {
Expand Down
2 changes: 1 addition & 1 deletion src/components/render-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class RenderComponentElement extends ComponentElement {
}

/**
* Gets the render component.
* Gets the underlying PlayCanvas render component.
* @returns The render component.
*/
get component(): RenderComponent | null {
Expand Down
4 changes: 2 additions & 2 deletions src/components/rigidbody-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ class RigidBodyComponentElement extends ComponentElement {
}

/**
* Gets the collision component.
* @returns The collision component.
* Gets the underlying PlayCanvas rigidbody component.
* @returns The rigidbody component.
*/
get component(): RigidBodyComponent | null {
return super.component as RigidBodyComponent | null;
Expand Down
2 changes: 1 addition & 1 deletion src/components/screen-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ScreenComponentElement extends ComponentElement {
}

/**
* Gets the screen component.
* Gets the underlying PlayCanvas screen component.
* @returns The screen component.
*/
get component(): ScreenComponent | null {
Expand Down
2 changes: 1 addition & 1 deletion src/components/script-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class ScriptComponentElement extends ComponentElement {
}

/**
* Gets the script component.
* Gets the underlying PlayCanvas script component.
* @returns The script component.
*/
get component(): ScriptComponent | null {
Expand Down
2 changes: 1 addition & 1 deletion src/components/sound-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class SoundComponentElement extends ComponentElement {
}

/**
* Gets the sound component.
* Gets the underlying PlayCanvas sound component.
* @returns The sound component.
*/
get component(): SoundComponent | null {
Expand Down
4 changes: 2 additions & 2 deletions src/components/sound-slot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class SoundSlotElement extends AsyncElement {
}

/**
* Sets the asset of the sound slot.
* Sets the id of the `pc-asset` to use for the sound slot.
* @param value - The asset.
*/
set asset(value: string) {
Expand All @@ -85,7 +85,7 @@ class SoundSlotElement extends AsyncElement {
}

/**
* Gets the asset of the sound slot.
* Gets the id of the `pc-asset` to use for the sound slot.
* @returns The asset.
*/
get asset() {
Expand Down
12 changes: 10 additions & 2 deletions src/components/splat-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@ class SplatComponentElement extends ComponentElement {
}

/**
* Gets the gsplat component.
* @returns The gsplat component.
* Gets the underlying PlayCanvas splat component.
* @returns The splat component.
*/
get component(): GSplatComponent | null {
return super.component as GSplatComponent | null;
}

/**
* Sets id of the `pc-asset` to use for the splat.
* @param value - The asset ID.
*/
set asset(value: string) {
this._asset = value;
const asset = AssetElement.get(value);
Expand All @@ -40,6 +44,10 @@ class SplatComponentElement extends ComponentElement {
}
}

/**
* Gets the id of the `pc-asset` to use for the splat.
* @returns The asset ID.
*/
get asset() {
return this._asset;
}
Expand Down
6 changes: 3 additions & 3 deletions src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class ModelElement extends AsyncElement {
}

/**
* Sets the asset ID of the model.
* Sets the id of the `pc-asset` to use for the model.
* @param value - The asset ID.
*/
set asset(value: string) {
Expand All @@ -85,8 +85,8 @@ class ModelElement extends AsyncElement {
}

/**
* Gets the source URL of the model.
* @returns The source URL of the model.
* Gets the id of the `pc-asset` to use for the model.
* @returns The asset ID.
*/
get asset(): string {
return this._asset;
Expand Down
Loading
Loading