@playcanvas/web-components 0.1.11 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -303
- package/dist/app.d.ts +4 -1
- package/dist/asset.d.ts +10 -9
- package/dist/components/camera-component.d.ts +4 -3
- package/dist/components/collision-component.d.ts +4 -3
- package/dist/components/element-component.d.ts +84 -3
- package/dist/components/light-component.d.ts +4 -3
- package/dist/components/listener-component.d.ts +4 -3
- package/dist/components/render-component.d.ts +4 -3
- package/dist/components/rigidbody-component.d.ts +5 -4
- package/dist/components/screen-component.d.ts +4 -3
- package/dist/components/script-component.d.ts +4 -3
- package/dist/components/sound-component.d.ts +4 -3
- package/dist/components/sound-slot.d.ts +2 -2
- package/dist/components/splat-component.d.ts +36 -0
- package/dist/entity.d.ts +3 -2
- package/dist/index.d.ts +2 -2
- package/dist/material.d.ts +3 -2
- package/dist/model.d.ts +6 -5
- package/dist/module.d.ts +3 -2
- package/dist/pwc.cjs +252 -79
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +252 -79
- package/dist/pwc.js.map +1 -1
- package/dist/pwc.min.js +1 -1
- package/dist/pwc.min.js.map +1 -1
- package/dist/pwc.mjs +252 -79
- package/dist/pwc.mjs.map +1 -1
- package/dist/scene.d.ts +3 -2
- package/dist/sky.d.ts +64 -0
- package/package.json +24 -24
- package/src/app.ts +14 -10
- package/src/asset.ts +17 -16
- package/src/components/camera-component.ts +4 -3
- package/src/components/collision-component.ts +4 -3
- package/src/components/element-component.ts +84 -3
- package/src/components/light-component.ts +4 -3
- package/src/components/listener-component.ts +4 -3
- package/src/components/render-component.ts +4 -3
- package/src/components/rigidbody-component.ts +5 -4
- package/src/components/screen-component.ts +4 -3
- package/src/components/script-component.ts +4 -3
- package/src/components/sound-component.ts +4 -3
- package/src/components/sound-slot.ts +2 -2
- package/src/components/{gsplat-component.ts → splat-component.ts} +17 -8
- package/src/entity.ts +3 -2
- package/src/index.ts +2 -2
- package/src/material.ts +6 -5
- package/src/model.ts +8 -7
- package/src/module.ts +3 -2
- package/src/scene.ts +3 -2
- package/src/sky.ts +64 -0
- package/dist/components/gsplat-component.d.ts +0 -27
- package/dist/fog.d.ts +0 -28
- package/src/fog.ts +0 -121
package/src/app.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Application, CameraComponent, FILLMODE_FILL_WINDOW, Keyboard, Mouse, Picker, RESOLUTION_AUTO } from 'playcanvas';
|
|
1
|
+
import { Application, CameraComponent, FILLMODE_FILL_WINDOW, GraphNode, Keyboard, Mouse, Picker, RESOLUTION_AUTO } from 'playcanvas';
|
|
2
2
|
|
|
3
3
|
import { AssetElement } from './asset';
|
|
4
4
|
import { AsyncElement } from './async-element';
|
|
@@ -7,7 +7,10 @@ import { MaterialElement } from './material';
|
|
|
7
7
|
import { ModuleElement } from './module';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* The
|
|
10
|
+
* The AppElement interface provides properties and methods for manipulating
|
|
11
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-app/ | `<pc-app>`} elements.
|
|
12
|
+
* The AppElement interface also inherits the properties and methods of the
|
|
13
|
+
* {@link HTMLElement} interface.
|
|
11
14
|
*/
|
|
12
15
|
class AppElement extends AsyncElement {
|
|
13
16
|
/**
|
|
@@ -206,13 +209,14 @@ class AppElement extends AsyncElement {
|
|
|
206
209
|
// Get the currently hovered entity by walking up the hierarchy
|
|
207
210
|
let newHoverEntity = null;
|
|
208
211
|
if (selection.length > 0) {
|
|
209
|
-
let
|
|
210
|
-
while (
|
|
211
|
-
const entityElement = this.querySelector(`pc-entity[name="${
|
|
212
|
+
let currentNode: GraphNode | null = selection[0].node;
|
|
213
|
+
while (currentNode !== null) {
|
|
214
|
+
const entityElement = this.querySelector(`pc-entity[name="${currentNode.name}"]`) as EntityElement;
|
|
212
215
|
if (entityElement) {
|
|
213
216
|
newHoverEntity = entityElement;
|
|
217
|
+
break;
|
|
214
218
|
}
|
|
215
|
-
|
|
219
|
+
currentNode = currentNode.parent;
|
|
216
220
|
}
|
|
217
221
|
}
|
|
218
222
|
|
|
@@ -249,14 +253,14 @@ class AppElement extends AsyncElement {
|
|
|
249
253
|
const selection = this._picker.getSelection(x, y);
|
|
250
254
|
|
|
251
255
|
if (selection.length > 0) {
|
|
252
|
-
let
|
|
253
|
-
while (
|
|
254
|
-
const entityElement = this.querySelector(`pc-entity[name="${
|
|
256
|
+
let currentNode: GraphNode | null = selection[0].node;
|
|
257
|
+
while (currentNode !== null) {
|
|
258
|
+
const entityElement = this.querySelector(`pc-entity[name="${currentNode.name}"]`) as EntityElement;
|
|
255
259
|
if (entityElement && entityElement.hasListeners('pointerdown')) {
|
|
256
260
|
entityElement.dispatchEvent(new PointerEvent('pointerdown', event));
|
|
257
261
|
break;
|
|
258
262
|
}
|
|
259
|
-
|
|
263
|
+
currentNode = currentNode.parent;
|
|
260
264
|
}
|
|
261
265
|
}
|
|
262
266
|
}
|
package/src/asset.ts
CHANGED
|
@@ -22,11 +22,12 @@ const extToType = new Map([
|
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* The AssetElement interface provides properties and methods for manipulating
|
|
25
|
-
* `<pc-asset>` elements.
|
|
26
|
-
*
|
|
25
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-asset/ | `<pc-asset>`} elements.
|
|
26
|
+
* The AssetElement interface also inherits the properties and methods of the
|
|
27
|
+
* {@link HTMLElement} interface.
|
|
27
28
|
*/
|
|
28
29
|
class AssetElement extends HTMLElement {
|
|
29
|
-
private
|
|
30
|
+
private _lazy: boolean = false;
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* The asset that is loaded.
|
|
@@ -54,7 +55,7 @@ class AssetElement extends HTMLElement {
|
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
this.asset = new Asset(id, type, { url: src });
|
|
57
|
-
this.asset.preload = this.
|
|
58
|
+
this.asset.preload = !this._lazy;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
destroyAsset() {
|
|
@@ -65,22 +66,22 @@ class AssetElement extends HTMLElement {
|
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
/**
|
|
68
|
-
* Sets the
|
|
69
|
-
* @param value - The
|
|
69
|
+
* Sets whether the asset should be loaded lazily.
|
|
70
|
+
* @param value - The lazy loading flag.
|
|
70
71
|
*/
|
|
71
|
-
set
|
|
72
|
-
this.
|
|
72
|
+
set lazy(value: boolean) {
|
|
73
|
+
this._lazy = value;
|
|
73
74
|
if (this.asset) {
|
|
74
|
-
this.asset.preload = value;
|
|
75
|
+
this.asset.preload = !value;
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
/**
|
|
79
|
-
* Gets the
|
|
80
|
-
* @returns The
|
|
80
|
+
* Gets whether the asset should be loaded lazily.
|
|
81
|
+
* @returns The lazy loading flag.
|
|
81
82
|
*/
|
|
82
|
-
get
|
|
83
|
-
return this.
|
|
83
|
+
get lazy() {
|
|
84
|
+
return this._lazy;
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
static get(id: string) {
|
|
@@ -89,12 +90,12 @@ class AssetElement extends HTMLElement {
|
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
static get observedAttributes() {
|
|
92
|
-
return ['
|
|
93
|
+
return ['lazy'];
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
attributeChangedCallback(name: string, _oldValue: string, _newValue: string) {
|
|
96
|
-
if (name === '
|
|
97
|
-
this.
|
|
97
|
+
if (name === 'lazy') {
|
|
98
|
+
this.lazy = this.hasAttribute('lazy');
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
101
|
}
|
|
@@ -15,8 +15,9 @@ const tonemaps = new Map([
|
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* The CameraComponentElement interface provides properties and methods for manipulating
|
|
18
|
-
* `<pc-camera>` elements.
|
|
19
|
-
*
|
|
18
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-camera/ | `<pc-camera>`} elements.
|
|
19
|
+
* The CameraComponentElement interface also inherits the properties and methods of the
|
|
20
|
+
* {@link HTMLElement} interface.
|
|
20
21
|
*
|
|
21
22
|
* @category Components
|
|
22
23
|
*/
|
|
@@ -107,7 +108,7 @@ class CameraComponentElement extends ComponentElement {
|
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
/**
|
|
110
|
-
* Gets the camera component.
|
|
111
|
+
* Gets the underlying PlayCanvas camera component.
|
|
111
112
|
* @returns The camera component.
|
|
112
113
|
*/
|
|
113
114
|
get component(): CameraComponent | null {
|
|
@@ -5,8 +5,9 @@ import { parseQuat, parseVec3 } from '../utils';
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The CollisionComponentElement interface provides properties and methods for manipulating
|
|
8
|
-
* `<pc-collision>` elements.
|
|
9
|
-
* and methods of the
|
|
8
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-collision/ | `<pc-collision>`} elements.
|
|
9
|
+
* The CollisionComponentElement interface also inherits the properties and methods of the
|
|
10
|
+
* {@link HTMLElement} interface.
|
|
10
11
|
*
|
|
11
12
|
* @category Components
|
|
12
13
|
*/
|
|
@@ -46,7 +47,7 @@ class CollisionComponentElement extends ComponentElement {
|
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
/**
|
|
49
|
-
* Gets the collision component.
|
|
50
|
+
* Gets the underlying PlayCanvas collision component.
|
|
50
51
|
* @returns The collision component.
|
|
51
52
|
*/
|
|
52
53
|
get component(): CollisionComponent | null {
|
|
@@ -6,8 +6,9 @@ import { parseColor, parseVec2, parseVec4 } from '../utils';
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* The ElementComponentElement interface provides properties and methods for manipulating
|
|
9
|
-
* `<pc-element>` elements.
|
|
10
|
-
*
|
|
9
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-element/ | `<pc-element>`} elements.
|
|
10
|
+
* The ElementComponentElement interface also inherits the properties and methods of the
|
|
11
|
+
* {@link HTMLElement} interface.
|
|
11
12
|
*
|
|
12
13
|
* @category Components
|
|
13
14
|
*/
|
|
@@ -60,13 +61,17 @@ class ElementComponentElement extends ComponentElement {
|
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
/**
|
|
63
|
-
* Gets the element component.
|
|
64
|
+
* Gets the underlying PlayCanvas element component.
|
|
64
65
|
* @returns The element component.
|
|
65
66
|
*/
|
|
66
67
|
get component(): ElementComponent | null {
|
|
67
68
|
return super.component as ElementComponent | null;
|
|
68
69
|
}
|
|
69
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Sets the anchor of the element component.
|
|
73
|
+
* @param value - The anchor.
|
|
74
|
+
*/
|
|
70
75
|
set anchor(value: Vec4) {
|
|
71
76
|
this._anchor = value;
|
|
72
77
|
if (this.component) {
|
|
@@ -74,10 +79,18 @@ class ElementComponentElement extends ComponentElement {
|
|
|
74
79
|
}
|
|
75
80
|
}
|
|
76
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Gets the anchor of the element component.
|
|
84
|
+
* @returns The anchor.
|
|
85
|
+
*/
|
|
77
86
|
get anchor() {
|
|
78
87
|
return this._anchor;
|
|
79
88
|
}
|
|
80
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Sets the id of the `pc-asset` to use for the font.
|
|
92
|
+
* @param value - The asset ID.
|
|
93
|
+
*/
|
|
81
94
|
set asset(value: string) {
|
|
82
95
|
this._asset = value;
|
|
83
96
|
const asset = AssetElement.get(value);
|
|
@@ -86,10 +99,18 @@ class ElementComponentElement extends ComponentElement {
|
|
|
86
99
|
}
|
|
87
100
|
}
|
|
88
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Gets the id of the `pc-asset` to use for the font.
|
|
104
|
+
* @returns The asset ID.
|
|
105
|
+
*/
|
|
89
106
|
get asset() {
|
|
90
107
|
return this._asset;
|
|
91
108
|
}
|
|
92
109
|
|
|
110
|
+
/**
|
|
111
|
+
* Sets whether the element component should automatically adjust its width.
|
|
112
|
+
* @param value - Whether to automatically adjust the width.
|
|
113
|
+
*/
|
|
93
114
|
set autoWidth(value: boolean) {
|
|
94
115
|
this._autoWidth = value;
|
|
95
116
|
if (this.component) {
|
|
@@ -97,10 +118,18 @@ class ElementComponentElement extends ComponentElement {
|
|
|
97
118
|
}
|
|
98
119
|
}
|
|
99
120
|
|
|
121
|
+
/**
|
|
122
|
+
* Gets whether the element component should automatically adjust its width.
|
|
123
|
+
* @returns Whether to automatically adjust the width.
|
|
124
|
+
*/
|
|
100
125
|
get autoWidth() {
|
|
101
126
|
return this._autoWidth;
|
|
102
127
|
}
|
|
103
128
|
|
|
129
|
+
/**
|
|
130
|
+
* Sets the color of the element component.
|
|
131
|
+
* @param value - The color.
|
|
132
|
+
*/
|
|
104
133
|
set color(value: Color) {
|
|
105
134
|
this._color = value;
|
|
106
135
|
if (this.component) {
|
|
@@ -108,10 +137,18 @@ class ElementComponentElement extends ComponentElement {
|
|
|
108
137
|
}
|
|
109
138
|
}
|
|
110
139
|
|
|
140
|
+
/**
|
|
141
|
+
* Gets the color of the element component.
|
|
142
|
+
* @returns The color.
|
|
143
|
+
*/
|
|
111
144
|
get color() {
|
|
112
145
|
return this._color;
|
|
113
146
|
}
|
|
114
147
|
|
|
148
|
+
/**
|
|
149
|
+
* Sets the font size of the element component.
|
|
150
|
+
* @param value - The font size.
|
|
151
|
+
*/
|
|
115
152
|
set fontSize(value: number) {
|
|
116
153
|
this._fontSize = value;
|
|
117
154
|
if (this.component) {
|
|
@@ -119,10 +156,18 @@ class ElementComponentElement extends ComponentElement {
|
|
|
119
156
|
}
|
|
120
157
|
}
|
|
121
158
|
|
|
159
|
+
/**
|
|
160
|
+
* Gets the font size of the element component.
|
|
161
|
+
* @returns The font size.
|
|
162
|
+
*/
|
|
122
163
|
get fontSize() {
|
|
123
164
|
return this._fontSize;
|
|
124
165
|
}
|
|
125
166
|
|
|
167
|
+
/**
|
|
168
|
+
* Sets the line height of the element component.
|
|
169
|
+
* @param value - The line height.
|
|
170
|
+
*/
|
|
126
171
|
set lineHeight(value: number) {
|
|
127
172
|
this._lineHeight = value;
|
|
128
173
|
if (this.component) {
|
|
@@ -130,10 +175,18 @@ class ElementComponentElement extends ComponentElement {
|
|
|
130
175
|
}
|
|
131
176
|
}
|
|
132
177
|
|
|
178
|
+
/**
|
|
179
|
+
* Gets the line height of the element component.
|
|
180
|
+
* @returns The line height.
|
|
181
|
+
*/
|
|
133
182
|
get lineHeight() {
|
|
134
183
|
return this._lineHeight;
|
|
135
184
|
}
|
|
136
185
|
|
|
186
|
+
/**
|
|
187
|
+
* Sets the pivot of the element component.
|
|
188
|
+
* @param value - The pivot.
|
|
189
|
+
*/
|
|
137
190
|
set pivot(value: Vec2) {
|
|
138
191
|
this._pivot = value;
|
|
139
192
|
if (this.component) {
|
|
@@ -141,10 +194,18 @@ class ElementComponentElement extends ComponentElement {
|
|
|
141
194
|
}
|
|
142
195
|
}
|
|
143
196
|
|
|
197
|
+
/**
|
|
198
|
+
* Gets the pivot of the element component.
|
|
199
|
+
* @returns The pivot.
|
|
200
|
+
*/
|
|
144
201
|
get pivot() {
|
|
145
202
|
return this._pivot;
|
|
146
203
|
}
|
|
147
204
|
|
|
205
|
+
/**
|
|
206
|
+
* Sets the text of the element component.
|
|
207
|
+
* @param value - The text.
|
|
208
|
+
*/
|
|
148
209
|
set text(value: string) {
|
|
149
210
|
this._text = value;
|
|
150
211
|
if (this.component) {
|
|
@@ -152,6 +213,10 @@ class ElementComponentElement extends ComponentElement {
|
|
|
152
213
|
}
|
|
153
214
|
}
|
|
154
215
|
|
|
216
|
+
/**
|
|
217
|
+
* Gets the text of the element component.
|
|
218
|
+
* @returns The text.
|
|
219
|
+
*/
|
|
155
220
|
get text() {
|
|
156
221
|
return this._text;
|
|
157
222
|
}
|
|
@@ -175,6 +240,10 @@ class ElementComponentElement extends ComponentElement {
|
|
|
175
240
|
return this._type;
|
|
176
241
|
}
|
|
177
242
|
|
|
243
|
+
/**
|
|
244
|
+
* Sets the width of the element component.
|
|
245
|
+
* @param value - The width.
|
|
246
|
+
*/
|
|
178
247
|
set width(value: number) {
|
|
179
248
|
this._width = value;
|
|
180
249
|
if (this.component) {
|
|
@@ -182,10 +251,18 @@ class ElementComponentElement extends ComponentElement {
|
|
|
182
251
|
}
|
|
183
252
|
}
|
|
184
253
|
|
|
254
|
+
/**
|
|
255
|
+
* Gets the width of the element component.
|
|
256
|
+
* @returns The width.
|
|
257
|
+
*/
|
|
185
258
|
get width() {
|
|
186
259
|
return this._width;
|
|
187
260
|
}
|
|
188
261
|
|
|
262
|
+
/**
|
|
263
|
+
* Sets whether the element component should wrap lines.
|
|
264
|
+
* @param value - Whether to wrap lines.
|
|
265
|
+
*/
|
|
189
266
|
set wrapLines(value: boolean) {
|
|
190
267
|
this._wrapLines = value;
|
|
191
268
|
if (this.component) {
|
|
@@ -193,6 +270,10 @@ class ElementComponentElement extends ComponentElement {
|
|
|
193
270
|
}
|
|
194
271
|
}
|
|
195
272
|
|
|
273
|
+
/**
|
|
274
|
+
* Gets whether the element component should wrap lines.
|
|
275
|
+
* @returns Whether to wrap lines.
|
|
276
|
+
*/
|
|
196
277
|
get wrapLines() {
|
|
197
278
|
return this._wrapLines;
|
|
198
279
|
}
|
|
@@ -17,8 +17,9 @@ const shadowTypes = new Map([
|
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* The LightComponentElement interface provides properties and methods for manipulating
|
|
20
|
-
* `<pc-light>` elements.
|
|
21
|
-
*
|
|
20
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-light/ | `<pc-light>`} elements.
|
|
21
|
+
* The LightComponentElement interface also inherits the properties and methods of the
|
|
22
|
+
* {@link HTMLElement} interface.
|
|
22
23
|
*
|
|
23
24
|
* @category Components
|
|
24
25
|
*/
|
|
@@ -76,7 +77,7 @@ class LightComponentElement extends ComponentElement {
|
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
/**
|
|
79
|
-
* Gets the light component.
|
|
80
|
+
* Gets the underlying PlayCanvas light component.
|
|
80
81
|
* @returns The light component.
|
|
81
82
|
*/
|
|
82
83
|
get component(): LightComponent | null {
|
|
@@ -4,8 +4,9 @@ import { ComponentElement } from './component';
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The ListenerComponentElement interface provides properties and methods for manipulating
|
|
7
|
-
* `<pc-listener>` elements.
|
|
8
|
-
* and methods of the
|
|
7
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-listener/ | `<pc-listener>`} elements.
|
|
8
|
+
* The ListenerComponentElement interface also inherits the properties and methods of the
|
|
9
|
+
* {@link HTMLElement} interface.
|
|
9
10
|
*
|
|
10
11
|
* @category Components
|
|
11
12
|
*/
|
|
@@ -16,7 +17,7 @@ class ListenerComponentElement extends ComponentElement {
|
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
|
-
* Gets the audio listener component.
|
|
20
|
+
* Gets the underlying PlayCanvas audio listener component.
|
|
20
21
|
* @returns The audio listener component.
|
|
21
22
|
*/
|
|
22
23
|
get component(): AudioListenerComponent | null {
|
|
@@ -5,8 +5,9 @@ import { MaterialElement } from '../material';
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The RenderComponentElement interface provides properties and methods for manipulating
|
|
8
|
-
* `<pc-render>` elements.
|
|
9
|
-
*
|
|
8
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-render/ | `<pc-render>`} elements.
|
|
9
|
+
* The RenderComponentElement interface also inherits the properties and methods of the
|
|
10
|
+
* {@link HTMLElement} interface.
|
|
10
11
|
*
|
|
11
12
|
* @category Components
|
|
12
13
|
*/
|
|
@@ -34,7 +35,7 @@ class RenderComponentElement extends ComponentElement {
|
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
/**
|
|
37
|
-
* Gets the render component.
|
|
38
|
+
* Gets the underlying PlayCanvas render component.
|
|
38
39
|
* @returns The render component.
|
|
39
40
|
*/
|
|
40
41
|
get component(): RenderComponent | null {
|
|
@@ -5,8 +5,9 @@ import { parseVec3 } from '../utils';
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The RigidBodyComponentElement interface provides properties and methods for manipulating
|
|
8
|
-
* `<pc-rigidbody>` elements.
|
|
9
|
-
* and methods of the
|
|
8
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-rigidbody/ | `<pc-rigidbody>`} elements.
|
|
9
|
+
* The RigidBodyComponentElement interface also inherits the properties and methods of the
|
|
10
|
+
* {@link HTMLElement} interface.
|
|
10
11
|
*
|
|
11
12
|
* @category Components
|
|
12
13
|
*/
|
|
@@ -76,8 +77,8 @@ class RigidBodyComponentElement extends ComponentElement {
|
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
/**
|
|
79
|
-
* Gets the
|
|
80
|
-
* @returns The
|
|
80
|
+
* Gets the underlying PlayCanvas rigidbody component.
|
|
81
|
+
* @returns The rigidbody component.
|
|
81
82
|
*/
|
|
82
83
|
get component(): RigidBodyComponent | null {
|
|
83
84
|
return super.component as RigidBodyComponent | null;
|
|
@@ -5,8 +5,9 @@ import { parseVec2 } from '../utils';
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The ScreenComponentElement interface provides properties and methods for manipulating
|
|
8
|
-
* `<pc-screen>` elements.
|
|
9
|
-
*
|
|
8
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-screen/ | `<pc-screen>`} elements.
|
|
9
|
+
* The ScreenComponentElement interface also inherits the properties and methods of the
|
|
10
|
+
* {@link HTMLElement} interface.
|
|
10
11
|
*
|
|
11
12
|
* @category Components
|
|
12
13
|
*/
|
|
@@ -40,7 +41,7 @@ class ScreenComponentElement extends ComponentElement {
|
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
/**
|
|
43
|
-
* Gets the screen component.
|
|
44
|
+
* Gets the underlying PlayCanvas screen component.
|
|
44
45
|
* @returns The screen component.
|
|
45
46
|
*/
|
|
46
47
|
get component(): ScreenComponent | null {
|
|
@@ -23,8 +23,9 @@ declare global {
|
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* The ScriptComponentElement interface provides properties and methods for manipulating
|
|
26
|
-
* `<pc-scripts>` elements.
|
|
27
|
-
*
|
|
26
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-scripts/ | `<pc-scripts>`} elements.
|
|
27
|
+
* The ScriptComponentElement interface also inherits the properties and methods of the
|
|
28
|
+
* {@link HTMLElement} interface.
|
|
28
29
|
*
|
|
29
30
|
* @category Components
|
|
30
31
|
*/
|
|
@@ -189,7 +190,7 @@ class ScriptComponentElement extends ComponentElement {
|
|
|
189
190
|
}
|
|
190
191
|
|
|
191
192
|
/**
|
|
192
|
-
* Gets the script component.
|
|
193
|
+
* Gets the underlying PlayCanvas script component.
|
|
193
194
|
* @returns The script component.
|
|
194
195
|
*/
|
|
195
196
|
get component(): ScriptComponent | null {
|
|
@@ -4,8 +4,9 @@ import { ComponentElement } from './component';
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The SoundComponentElement interface provides properties and methods for manipulating
|
|
7
|
-
* `<pc-sounds>` elements.
|
|
8
|
-
*
|
|
7
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-sounds/ | `<pc-sounds>`} elements.
|
|
8
|
+
* The SoundComponentElement interface also inherits the properties and methods of the
|
|
9
|
+
* {@link HTMLElement} interface.
|
|
9
10
|
*
|
|
10
11
|
* @category Components
|
|
11
12
|
*/
|
|
@@ -42,7 +43,7 @@ class SoundComponentElement extends ComponentElement {
|
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
/**
|
|
45
|
-
* Gets the sound component.
|
|
46
|
+
* Gets the underlying PlayCanvas sound component.
|
|
46
47
|
* @returns The sound component.
|
|
47
48
|
*/
|
|
48
49
|
get component(): SoundComponent | null {
|
|
@@ -71,7 +71,7 @@ class SoundSlotElement extends AsyncElement {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
|
-
* Sets the
|
|
74
|
+
* Sets the id of the `pc-asset` to use for the sound slot.
|
|
75
75
|
* @param value - The asset.
|
|
76
76
|
*/
|
|
77
77
|
set asset(value: string) {
|
|
@@ -85,7 +85,7 @@ class SoundSlotElement extends AsyncElement {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
|
-
* Gets the
|
|
88
|
+
* Gets the id of the `pc-asset` to use for the sound slot.
|
|
89
89
|
* @returns The asset.
|
|
90
90
|
*/
|
|
91
91
|
get asset() {
|
|
@@ -4,13 +4,14 @@ import { ComponentElement } from './component';
|
|
|
4
4
|
import { AssetElement } from '../asset';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* The
|
|
8
|
-
* `<pc-splat>` elements.
|
|
9
|
-
*
|
|
7
|
+
* The SplatComponentElement interface provides properties and methods for manipulating
|
|
8
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-splat/ | `<pc-splat>`} elements.
|
|
9
|
+
* The SplatComponentElement interface also inherits the properties and methods of the
|
|
10
|
+
* {@link HTMLElement} interface.
|
|
10
11
|
*
|
|
11
12
|
* @category Components
|
|
12
13
|
*/
|
|
13
|
-
class
|
|
14
|
+
class SplatComponentElement extends ComponentElement {
|
|
14
15
|
private _asset: string = '';
|
|
15
16
|
|
|
16
17
|
/** @ignore */
|
|
@@ -25,13 +26,17 @@ class GSplatComponentElement extends ComponentElement {
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
|
-
* Gets the
|
|
29
|
-
* @returns The
|
|
29
|
+
* Gets the underlying PlayCanvas splat component.
|
|
30
|
+
* @returns The splat component.
|
|
30
31
|
*/
|
|
31
32
|
get component(): GSplatComponent | null {
|
|
32
33
|
return super.component as GSplatComponent | null;
|
|
33
34
|
}
|
|
34
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Sets id of the `pc-asset` to use for the splat.
|
|
38
|
+
* @param value - The asset ID.
|
|
39
|
+
*/
|
|
35
40
|
set asset(value: string) {
|
|
36
41
|
this._asset = value;
|
|
37
42
|
const asset = AssetElement.get(value);
|
|
@@ -40,6 +45,10 @@ class GSplatComponentElement extends ComponentElement {
|
|
|
40
45
|
}
|
|
41
46
|
}
|
|
42
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Gets the id of the `pc-asset` to use for the splat.
|
|
50
|
+
* @returns The asset ID.
|
|
51
|
+
*/
|
|
43
52
|
get asset() {
|
|
44
53
|
return this._asset;
|
|
45
54
|
}
|
|
@@ -59,6 +68,6 @@ class GSplatComponentElement extends ComponentElement {
|
|
|
59
68
|
}
|
|
60
69
|
}
|
|
61
70
|
|
|
62
|
-
customElements.define('pc-splat',
|
|
71
|
+
customElements.define('pc-splat', SplatComponentElement);
|
|
63
72
|
|
|
64
|
-
export {
|
|
73
|
+
export { SplatComponentElement };
|
package/src/entity.ts
CHANGED
|
@@ -5,8 +5,9 @@ import { parseVec3 } from './utils';
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The EntityElement interface provides properties and methods for manipulating
|
|
8
|
-
* `<pc-entity>` elements.
|
|
9
|
-
*
|
|
8
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-entity/ | `<pc-entity>`} elements.
|
|
9
|
+
* The EntityElement interface also inherits the properties and methods of the
|
|
10
|
+
* {@link HTMLElement} interface.
|
|
10
11
|
*/
|
|
11
12
|
class EntityElement extends AsyncElement {
|
|
12
13
|
/**
|
package/src/index.ts
CHANGED
|
@@ -20,7 +20,7 @@ import { CameraComponentElement } from './components/camera-component';
|
|
|
20
20
|
import { CollisionComponentElement } from './components/collision-component';
|
|
21
21
|
import { ComponentElement } from './components/component';
|
|
22
22
|
import { ElementComponentElement } from './components/element-component';
|
|
23
|
-
import {
|
|
23
|
+
import { SplatComponentElement } from './components/splat-component';
|
|
24
24
|
import { LightComponentElement } from './components/light-component';
|
|
25
25
|
import { RenderComponentElement } from './components/render-component';
|
|
26
26
|
import { RigidBodyComponentElement } from './components/rigidbody-component';
|
|
@@ -44,7 +44,7 @@ export {
|
|
|
44
44
|
CollisionComponentElement,
|
|
45
45
|
ComponentElement,
|
|
46
46
|
ElementComponentElement,
|
|
47
|
-
|
|
47
|
+
SplatComponentElement,
|
|
48
48
|
LightComponentElement,
|
|
49
49
|
ListenerComponentElement,
|
|
50
50
|
RenderComponentElement,
|