angular-three 1.1.0 → 1.2.0
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 +6 -0
- package/esm2020/lib/canvas.mjs +8 -13
- package/esm2020/lib/di/destroy.mjs +2 -3
- package/esm2020/lib/di/ref.mjs +3 -6
- package/esm2020/lib/directives/args.mjs +3 -3
- package/esm2020/lib/directives/repeat.mjs +3 -3
- package/esm2020/lib/loader.mjs +4 -11
- package/esm2020/lib/pipes/push.mjs +4 -4
- package/esm2020/lib/portal.mjs +9 -9
- package/esm2020/lib/renderer/renderer.mjs +41 -27
- package/esm2020/lib/renderer/state.mjs +7 -2
- package/esm2020/lib/renderer/utils.mjs +3 -2
- package/esm2020/lib/stores/rx-store.mjs +6 -6
- package/esm2020/lib/stores/store.mjs +8 -19
- package/esm2020/lib/utils/apply-props.mjs +5 -9
- package/esm2020/lib/utils/update.mjs +5 -9
- package/fesm2015/angular-three.mjs +99 -114
- package/fesm2015/angular-three.mjs.map +1 -1
- package/fesm2020/angular-three.mjs +99 -114
- package/fesm2020/angular-three.mjs.map +1 -1
- package/lib/pipes/push.d.ts +1 -1
- package/lib/renderer/renderer.d.ts +3 -3
- package/lib/renderer/state.d.ts +1 -1
- package/package.json +4 -4
- package/plugin/package.json +3 -3
|
@@ -63,26 +63,19 @@ function injectLoader(loaderConstructorFactory, input, extensions, onProgress) {
|
|
|
63
63
|
return urls$.pipe(map((inputs) => {
|
|
64
64
|
const loaderConstructor = loaderConstructorFactory(inputs);
|
|
65
65
|
const loader = new loaderConstructor();
|
|
66
|
-
if (extensions)
|
|
66
|
+
if (extensions)
|
|
67
67
|
extensions(loader);
|
|
68
|
-
}
|
|
69
68
|
const urls = Array.isArray(inputs) ? inputs : typeof inputs === 'string' ? [inputs] : Object.values(inputs);
|
|
70
69
|
return [
|
|
71
70
|
urls.map((url) => {
|
|
72
71
|
if (!cached.has(url)) {
|
|
73
72
|
cached.set(url, from(loader.loadAsync(url, onProgress)).pipe(tap((data) => {
|
|
74
|
-
if (data.scene)
|
|
73
|
+
if (data.scene)
|
|
75
74
|
Object.assign(data, makeObjectGraph(data.scene));
|
|
76
|
-
}
|
|
77
75
|
}), retry(2), catchError((err) => {
|
|
78
76
|
console.error(`[NGT] Error loading ${url}: ${err.message}`);
|
|
79
77
|
return of([]);
|
|
80
|
-
}), share({
|
|
81
|
-
connector: () => new ReplaySubject(1),
|
|
82
|
-
resetOnComplete: true,
|
|
83
|
-
resetOnError: true,
|
|
84
|
-
resetOnRefCountZero: true,
|
|
85
|
-
})));
|
|
78
|
+
}), share({ connector: () => new ReplaySubject(1) })));
|
|
86
79
|
}
|
|
87
80
|
return cached.get(url);
|
|
88
81
|
}),
|
|
@@ -298,19 +291,16 @@ const is = {
|
|
|
298
291
|
function checkNeedsUpdate(value) {
|
|
299
292
|
if (value !== null && is.obj(value) && 'needsUpdate' in value) {
|
|
300
293
|
value['needsUpdate'] = true;
|
|
301
|
-
if ('uniformsNeedUpdate' in value)
|
|
294
|
+
if ('uniformsNeedUpdate' in value)
|
|
302
295
|
value['uniformsNeedUpdate'] = true;
|
|
303
|
-
}
|
|
304
296
|
}
|
|
305
297
|
}
|
|
306
298
|
function checkUpdate(value) {
|
|
307
|
-
if (is.object3D(value))
|
|
299
|
+
if (is.object3D(value))
|
|
308
300
|
value.updateMatrix();
|
|
309
|
-
}
|
|
310
301
|
if (is.camera(value)) {
|
|
311
|
-
if (is.perspectiveCamera(value) || is.orthographicCamera(value))
|
|
302
|
+
if (is.perspectiveCamera(value) || is.orthographicCamera(value))
|
|
312
303
|
value.updateProjectionMatrix();
|
|
313
|
-
}
|
|
314
304
|
value.updateMatrixWorld();
|
|
315
305
|
}
|
|
316
306
|
checkNeedsUpdate(value);
|
|
@@ -323,9 +313,8 @@ function updateCamera(camera, size) {
|
|
|
323
313
|
camera.top = size.height / 2;
|
|
324
314
|
camera.bottom = size.height / -2;
|
|
325
315
|
}
|
|
326
|
-
else
|
|
316
|
+
else
|
|
327
317
|
camera.aspect = size.width / size.height;
|
|
328
|
-
}
|
|
329
318
|
camera.updateProjectionMatrix();
|
|
330
319
|
camera.updateMatrixWorld();
|
|
331
320
|
}
|
|
@@ -426,9 +415,8 @@ function applyProps(instance, props) {
|
|
|
426
415
|
value.constructor &&
|
|
427
416
|
targetProp.constructor.name === value.constructor.name) {
|
|
428
417
|
targetProp['copy'](value);
|
|
429
|
-
if (!THREE.ColorManagement && !rootState.linear && isColor)
|
|
418
|
+
if (!THREE.ColorManagement && !rootState.linear && isColor)
|
|
430
419
|
targetProp['convertSRGBToLinear']();
|
|
431
|
-
}
|
|
432
420
|
}
|
|
433
421
|
// if nothing else fits, just set the single value, ignore undefined
|
|
434
422
|
else if (value !== undefined) {
|
|
@@ -437,17 +425,14 @@ function applyProps(instance, props) {
|
|
|
437
425
|
if (!isColor && targetProp['setScalar'])
|
|
438
426
|
targetProp['setScalar'](value);
|
|
439
427
|
// layers have no copy function, copy the mask
|
|
440
|
-
else if (targetProp instanceof THREE.Layers && value instanceof THREE.Layers)
|
|
428
|
+
else if (targetProp instanceof THREE.Layers && value instanceof THREE.Layers)
|
|
441
429
|
targetProp.mask = value.mask;
|
|
442
|
-
}
|
|
443
430
|
// otherwise just set ...
|
|
444
|
-
else
|
|
431
|
+
else
|
|
445
432
|
targetProp['set'](value);
|
|
446
|
-
}
|
|
447
433
|
// auto-convert srgb
|
|
448
|
-
if (!THREE.ColorManagement && !rootState?.linear && isColor)
|
|
434
|
+
if (!THREE.ColorManagement && !rootState?.linear && isColor)
|
|
449
435
|
targetProp.convertSRGBToLinear();
|
|
450
|
-
}
|
|
451
436
|
}
|
|
452
437
|
}
|
|
453
438
|
// else just overwrite the value
|
|
@@ -540,7 +525,7 @@ class NgtRxStore extends RxState {
|
|
|
540
525
|
const originalSet = this.set.bind(this);
|
|
541
526
|
Object.defineProperty(this, 'set', {
|
|
542
527
|
get: () => {
|
|
543
|
-
// Parameters type does not do well with overloads. So we use any[] here
|
|
528
|
+
// Parameters type does not do well with overloads (RxState#set). So we use any[] here
|
|
544
529
|
return (...args) => {
|
|
545
530
|
const firstArg = args[0];
|
|
546
531
|
if (is.obj(firstArg)) {
|
|
@@ -550,7 +535,7 @@ class NgtRxStore extends RxState {
|
|
|
550
535
|
}, {});
|
|
551
536
|
return originalSet(modArgs);
|
|
552
537
|
}
|
|
553
|
-
// @ts-
|
|
538
|
+
// @ts-expect-error not sure why ...args here doesn't pass tuple check
|
|
554
539
|
return originalSet(...args);
|
|
555
540
|
};
|
|
556
541
|
},
|
|
@@ -563,9 +548,9 @@ class NgtRxStore extends RxState {
|
|
|
563
548
|
return this.hold(obs.pipe(tapEffect(sideEffectFn)));
|
|
564
549
|
}
|
|
565
550
|
}
|
|
566
|
-
NgtRxStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.
|
|
567
|
-
NgtRxStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.
|
|
568
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.
|
|
551
|
+
NgtRxStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRxStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
552
|
+
NgtRxStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRxStore });
|
|
553
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRxStore, decorators: [{
|
|
569
554
|
type: Injectable
|
|
570
555
|
}], ctorParameters: function () { return []; } });
|
|
571
556
|
|
|
@@ -606,15 +591,7 @@ class NgtStore extends NgtRxStore {
|
|
|
606
591
|
const fov = (camera.fov * Math.PI) / 180; // convert vertical fov to radians
|
|
607
592
|
const h = 2 * Math.tan(fov / 2) * distance; // visible height
|
|
608
593
|
const w = h * aspect;
|
|
609
|
-
return {
|
|
610
|
-
width: w,
|
|
611
|
-
height: h,
|
|
612
|
-
top,
|
|
613
|
-
left,
|
|
614
|
-
factor: width / w,
|
|
615
|
-
distance,
|
|
616
|
-
aspect,
|
|
617
|
-
};
|
|
594
|
+
return { width: w, height: h, top, left, factor: width / w, distance, aspect };
|
|
618
595
|
};
|
|
619
596
|
const pointer = new THREE.Vector2();
|
|
620
597
|
let performanceTimeout;
|
|
@@ -794,9 +771,8 @@ class NgtStore extends NgtRxStore {
|
|
|
794
771
|
// update projection matrix after applyprops
|
|
795
772
|
camera.updateProjectionMatrix();
|
|
796
773
|
}
|
|
797
|
-
if (!is.instance(camera))
|
|
774
|
+
if (!is.instance(camera))
|
|
798
775
|
camera = prepare(camera, { store: this });
|
|
799
|
-
}
|
|
800
776
|
stateToUpdate.camera = camera;
|
|
801
777
|
}
|
|
802
778
|
// Set up XR (one time only!)
|
|
@@ -874,9 +850,8 @@ class NgtStore extends NgtRxStore {
|
|
|
874
850
|
applyProps(gl, glOptions);
|
|
875
851
|
}
|
|
876
852
|
// Store events internally
|
|
877
|
-
if (events && !state.events.handlers)
|
|
853
|
+
if (events && !state.events.handlers)
|
|
878
854
|
stateToUpdate.events = events(this);
|
|
879
|
-
}
|
|
880
855
|
// Check performance
|
|
881
856
|
if (performance && !is.equ(performance, state.performance, shallowLoose)) {
|
|
882
857
|
stateToUpdate.performance = { ...state.performance, ...performance };
|
|
@@ -892,9 +867,8 @@ class NgtStore extends NgtRxStore {
|
|
|
892
867
|
// Check frameloop
|
|
893
868
|
if (state.frameloop !== frameloop)
|
|
894
869
|
state.setFrameloop(frameloop);
|
|
895
|
-
if (!this.get('ready'))
|
|
870
|
+
if (!this.get('ready'))
|
|
896
871
|
this.set({ ready: true });
|
|
897
|
-
}
|
|
898
872
|
this.invalidate();
|
|
899
873
|
}
|
|
900
874
|
resize() {
|
|
@@ -925,9 +899,9 @@ class NgtStore extends NgtRxStore {
|
|
|
925
899
|
this.hold(this.select(), () => invalidate(this));
|
|
926
900
|
}
|
|
927
901
|
}
|
|
928
|
-
NgtStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.
|
|
929
|
-
NgtStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.
|
|
930
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.
|
|
902
|
+
NgtStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtStore, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
903
|
+
NgtStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtStore });
|
|
904
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtStore, decorators: [{
|
|
931
905
|
type: Injectable
|
|
932
906
|
}] });
|
|
933
907
|
function computeInitialSize(canvas, defaultSize) {
|
|
@@ -988,9 +962,9 @@ class NgtArgs {
|
|
|
988
962
|
this.view.detectChanges();
|
|
989
963
|
}
|
|
990
964
|
}
|
|
991
|
-
NgtArgs.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.
|
|
992
|
-
NgtArgs.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.
|
|
993
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.
|
|
965
|
+
NgtArgs.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtArgs, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
966
|
+
NgtArgs.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.2", type: NgtArgs, isStandalone: true, selector: "[args]", inputs: { args: "args" }, ngImport: i0 });
|
|
967
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtArgs, decorators: [{
|
|
994
968
|
type: Directive,
|
|
995
969
|
args: [{ selector: '[args]', standalone: true }]
|
|
996
970
|
}], ctorParameters: function () { return []; }, propDecorators: { args: [{
|
|
@@ -1392,7 +1366,8 @@ function attachThreeChild(parent, child) {
|
|
|
1392
1366
|
// whether the child is added to the parent with parent.add()
|
|
1393
1367
|
let added = false;
|
|
1394
1368
|
// assign store on child if not already exist
|
|
1395
|
-
|
|
1369
|
+
// or child store is the parent of parent store
|
|
1370
|
+
if (!cLS.store || cLS.store === pLS.store.get('previousStore')) {
|
|
1396
1371
|
cLS.store = pLS.store;
|
|
1397
1372
|
}
|
|
1398
1373
|
if (cLS.attach) {
|
|
@@ -1869,7 +1844,12 @@ class NgtRendererStore {
|
|
|
1869
1844
|
let i = this.portals.length - 1;
|
|
1870
1845
|
while (i >= 0) {
|
|
1871
1846
|
// loop through the portal state backwards to find the closest NgtStore
|
|
1872
|
-
const
|
|
1847
|
+
const portal = this.portals[i];
|
|
1848
|
+
if (portal.__ngt_renderer__[3 /* NgtRendererClassId.destroyed */]) {
|
|
1849
|
+
i--;
|
|
1850
|
+
continue;
|
|
1851
|
+
}
|
|
1852
|
+
const injector = portal.__ngt_renderer__[13 /* NgtRendererClassId.injectorFactory */]();
|
|
1873
1853
|
if (!injector) {
|
|
1874
1854
|
i--;
|
|
1875
1855
|
continue;
|
|
@@ -1893,31 +1873,47 @@ class NgtRendererFactory {
|
|
|
1893
1873
|
this.store = inject(NgtStore);
|
|
1894
1874
|
this.catalogue = inject(NGT_CATALOGUE);
|
|
1895
1875
|
this.compoundPrefixes = inject(NGT_COMPOUND_PREFIXES);
|
|
1896
|
-
this.
|
|
1897
|
-
store: this.store,
|
|
1898
|
-
cdr: this.cdr,
|
|
1899
|
-
compoundPrefixes: this.compoundPrefixes,
|
|
1900
|
-
});
|
|
1876
|
+
this.rendererMap = new Map();
|
|
1901
1877
|
}
|
|
1902
1878
|
createRenderer(hostElement, type) {
|
|
1903
|
-
|
|
1904
|
-
if (!
|
|
1905
|
-
|
|
1906
|
-
|
|
1879
|
+
const domRenderer = this.domRendererFactory.createRenderer(hostElement, type);
|
|
1880
|
+
if (!type)
|
|
1881
|
+
return domRenderer;
|
|
1882
|
+
let renderer = this.rendererMap.get(type.id);
|
|
1883
|
+
if (renderer)
|
|
1884
|
+
return renderer;
|
|
1885
|
+
if (!hostElement) {
|
|
1886
|
+
const store = new NgtRendererStore({
|
|
1887
|
+
store: this.store,
|
|
1888
|
+
cdr: this.cdr,
|
|
1889
|
+
compoundPrefixes: this.compoundPrefixes,
|
|
1890
|
+
});
|
|
1891
|
+
renderer = new NgtRenderer(domRenderer, store, this.catalogue, true);
|
|
1892
|
+
this.rendererMap.set(type.id, renderer);
|
|
1893
|
+
}
|
|
1894
|
+
if (!renderer) {
|
|
1895
|
+
const store = new NgtRendererStore({
|
|
1896
|
+
store: this.store,
|
|
1897
|
+
cdr: this.cdr,
|
|
1898
|
+
compoundPrefixes: this.compoundPrefixes,
|
|
1899
|
+
});
|
|
1900
|
+
renderer = new NgtRenderer(domRenderer, store, this.catalogue);
|
|
1901
|
+
this.rendererMap.set(type.id, renderer);
|
|
1907
1902
|
}
|
|
1908
|
-
return
|
|
1903
|
+
return renderer;
|
|
1909
1904
|
}
|
|
1910
1905
|
}
|
|
1911
|
-
NgtRendererFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.
|
|
1912
|
-
NgtRendererFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.
|
|
1913
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.
|
|
1906
|
+
NgtRendererFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRendererFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1907
|
+
NgtRendererFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRendererFactory });
|
|
1908
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRendererFactory, decorators: [{
|
|
1914
1909
|
type: Injectable
|
|
1915
1910
|
}] });
|
|
1916
1911
|
class NgtRenderer {
|
|
1917
|
-
constructor(domRenderer, store, catalogue) {
|
|
1912
|
+
constructor(domRenderer, store, catalogue, root = false) {
|
|
1918
1913
|
this.domRenderer = domRenderer;
|
|
1919
1914
|
this.store = store;
|
|
1920
1915
|
this.catalogue = catalogue;
|
|
1916
|
+
this.root = root;
|
|
1921
1917
|
this.first = false;
|
|
1922
1918
|
this.createText = this.domRenderer.createText.bind(this.domRenderer);
|
|
1923
1919
|
this.destroy = this.domRenderer.destroy.bind(this.domRenderer);
|
|
@@ -1934,7 +1930,7 @@ class NgtRenderer {
|
|
|
1934
1930
|
createElement(name, namespace) {
|
|
1935
1931
|
const element = this.domRenderer.createElement(name, namespace);
|
|
1936
1932
|
// on first pass, we return the Root Scene as the root node
|
|
1937
|
-
if (!this.first) {
|
|
1933
|
+
if (this.root && !this.first) {
|
|
1938
1934
|
this.first = true;
|
|
1939
1935
|
return this.store.createNode('three', this.store.rootScene);
|
|
1940
1936
|
}
|
|
@@ -1996,7 +1992,7 @@ class NgtRenderer {
|
|
|
1996
1992
|
}
|
|
1997
1993
|
this.store.setParent(newChild, parent);
|
|
1998
1994
|
this.store.addChild(parent, newChild);
|
|
1999
|
-
// if new
|
|
1995
|
+
// if new child is a portal
|
|
2000
1996
|
if (newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'portal') {
|
|
2001
1997
|
this.store.processPortalContainer(newChild);
|
|
2002
1998
|
if (newChild.__ngt_renderer__[12 /* NgtRendererClassId.portalContainer */]) {
|
|
@@ -2057,25 +2053,23 @@ class NgtRenderer {
|
|
|
2057
2053
|
this.store.setCompound(parent, newChild);
|
|
2058
2054
|
}
|
|
2059
2055
|
}
|
|
2060
|
-
|
|
2056
|
+
const shouldFindGrandparentInstance =
|
|
2057
|
+
// if child is three but haven't been attached to a parent yet
|
|
2058
|
+
(newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three' && !getLocalState(newChild).parent) ||
|
|
2059
|
+
// or both parent and child are DOM elements
|
|
2060
|
+
(parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'dom' &&
|
|
2061
|
+
newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'dom');
|
|
2062
|
+
if (shouldFindGrandparentInstance) {
|
|
2061
2063
|
// we'll try to get the grandparent instance here so that we can run appendChild with both instances
|
|
2062
2064
|
const closestGrandparentInstance = this.store.getClosestParentWithInstance(parent);
|
|
2063
2065
|
if (closestGrandparentInstance) {
|
|
2064
2066
|
this.appendChild(closestGrandparentInstance, newChild);
|
|
2065
2067
|
}
|
|
2066
|
-
return;
|
|
2067
|
-
}
|
|
2068
|
-
if (parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'dom' &&
|
|
2069
|
-
newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'dom') {
|
|
2070
|
-
const closestGrandparentInstance = this.store.getClosestParentWithInstance(parent);
|
|
2071
|
-
if (closestGrandparentInstance) {
|
|
2072
|
-
this.appendChild(closestGrandparentInstance, newChild);
|
|
2073
|
-
}
|
|
2074
2068
|
}
|
|
2075
2069
|
}
|
|
2076
2070
|
insertBefore(parent, newChild
|
|
2077
2071
|
// TODO we might need these?
|
|
2078
|
-
// refChild: NgtRendererNode
|
|
2072
|
+
// refChild: NgtRendererNode
|
|
2079
2073
|
// isMove?: boolean | undefined
|
|
2080
2074
|
) {
|
|
2081
2075
|
if (!parent.__ngt_renderer__)
|
|
@@ -2341,9 +2335,7 @@ class NgtCanvas extends NgtRxStore {
|
|
|
2341
2335
|
// set rootStateMap
|
|
2342
2336
|
rootStateMap.set(this.glCanvas.nativeElement, this.store);
|
|
2343
2337
|
// subscribe to store to listen for ready state
|
|
2344
|
-
this.hold(this.store.select('ready').pipe(filter((ready) => ready)), () =>
|
|
2345
|
-
this.storeReady();
|
|
2346
|
-
});
|
|
2338
|
+
this.hold(this.store.select('ready').pipe(filter((ready) => ready)), () => this.storeReady());
|
|
2347
2339
|
}
|
|
2348
2340
|
onResize({ width, height }) {
|
|
2349
2341
|
if (width > 0 && height > 0) {
|
|
@@ -2377,9 +2369,8 @@ class NgtCanvas extends NgtRxStore {
|
|
|
2377
2369
|
this.cdr.detectChanges();
|
|
2378
2370
|
}
|
|
2379
2371
|
// render
|
|
2380
|
-
if (this.glRef)
|
|
2372
|
+
if (this.glRef)
|
|
2381
2373
|
this.glRef.destroy();
|
|
2382
|
-
}
|
|
2383
2374
|
requestAnimationFrame(() => {
|
|
2384
2375
|
this.glEnvInjector = createEnvironmentInjector([
|
|
2385
2376
|
provideNgtRenderer({
|
|
@@ -2398,12 +2389,10 @@ class NgtCanvas extends NgtRxStore {
|
|
|
2398
2389
|
});
|
|
2399
2390
|
}
|
|
2400
2391
|
ngOnDestroy() {
|
|
2401
|
-
if (this.glRef)
|
|
2392
|
+
if (this.glRef)
|
|
2402
2393
|
this.glRef.destroy();
|
|
2403
|
-
|
|
2404
|
-
if (this.glEnvInjector) {
|
|
2394
|
+
if (this.glEnvInjector)
|
|
2405
2395
|
this.glEnvInjector.destroy();
|
|
2406
|
-
}
|
|
2407
2396
|
injectNgtLoader.destroy();
|
|
2408
2397
|
super.ngOnDestroy();
|
|
2409
2398
|
}
|
|
@@ -2415,13 +2404,13 @@ class NgtCanvas extends NgtRxStore {
|
|
|
2415
2404
|
};
|
|
2416
2405
|
}
|
|
2417
2406
|
}
|
|
2418
|
-
NgtCanvas.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.
|
|
2419
|
-
NgtCanvas.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.
|
|
2407
|
+
NgtCanvas.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtCanvas, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2408
|
+
NgtCanvas.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: NgtCanvas, isStandalone: true, selector: "ngt-canvas", inputs: { sceneGraph: "sceneGraph", compoundPrefixes: "compoundPrefixes", linear: "linear", legacy: "legacy", flat: "flat", orthographic: "orthographic", frameloop: "frameloop", dpr: "dpr", raycaster: "raycaster", shadows: "shadows", camera: "camera", gl: "gl", eventSource: "eventSource", eventPrefix: "eventPrefix", lookAt: "lookAt", performance: "performance" }, outputs: { created: "created", pointerMissed: "pointerMissed" }, host: { properties: { "class.ngt-canvas": "this.hostClass", "style.pointerEvents": "this.pointerEvents" } }, providers: [NgtStore, provideNgxResizeOptions({ emitInZone: false })], viewQueries: [{ propertyName: "glCanvas", first: true, predicate: ["glCanvas"], descendants: true, static: true }, { propertyName: "glAnchor", first: true, predicate: ["glCanvas"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, ngImport: i0, template: `
|
|
2420
2409
|
<div (ngxResize)="onResize($event)" style="height: 100%; width: 100%;">
|
|
2421
2410
|
<canvas #glCanvas style="display: block;"></canvas>
|
|
2422
2411
|
</div>
|
|
2423
2412
|
`, isInline: true, styles: [":host{display:block;position:relative;width:100%;height:100%;overflow:hidden}\n"], dependencies: [{ kind: "directive", type: NgxResize, selector: "[ngxResize]", inputs: ["ngxResizeOptions"], outputs: ["ngxResize"] }] });
|
|
2424
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.
|
|
2413
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtCanvas, decorators: [{
|
|
2425
2414
|
type: Component,
|
|
2426
2415
|
args: [{ selector: 'ngt-canvas', standalone: true, template: `
|
|
2427
2416
|
<div (ngxResize)="onResize($event)" style="height: 100%; width: 100%;">
|
|
@@ -2495,8 +2484,7 @@ function injectNgtDestroy(cb) {
|
|
|
2495
2484
|
return { destroy$, cdr };
|
|
2496
2485
|
}
|
|
2497
2486
|
catch (e) {
|
|
2498
|
-
|
|
2499
|
-
return {};
|
|
2487
|
+
throw new Error(`[NGT] injectNgtDestroy is being called outside of Constructor Context`);
|
|
2500
2488
|
}
|
|
2501
2489
|
}
|
|
2502
2490
|
|
|
@@ -2513,10 +2501,7 @@ function injectBeforeRender(cb, priority = 0) {
|
|
|
2513
2501
|
}
|
|
2514
2502
|
|
|
2515
2503
|
function injectNgtRef(initialValue = null) {
|
|
2516
|
-
|
|
2517
|
-
if (is.ref(initialValue)) {
|
|
2518
|
-
ref = initialValue;
|
|
2519
|
-
}
|
|
2504
|
+
const ref = is.ref(initialValue) ? initialValue : new ElementRef(initialValue);
|
|
2520
2505
|
let lastValue = ref.nativeElement;
|
|
2521
2506
|
const cdRefs = [];
|
|
2522
2507
|
const ref$ = new BehaviorSubject(lastValue);
|
|
@@ -2566,7 +2551,7 @@ function injectNgtRef(initialValue = null) {
|
|
|
2566
2551
|
}
|
|
2567
2552
|
// during creation phase, 'context' on ViewRef will be null
|
|
2568
2553
|
// we check the "context" to avoid running detectChanges during this phase.
|
|
2569
|
-
//
|
|
2554
|
+
// because there's nothing to check
|
|
2570
2555
|
if (cd['context']) {
|
|
2571
2556
|
cd.detectChanges();
|
|
2572
2557
|
}
|
|
@@ -2583,9 +2568,9 @@ class NgtRepeat extends NgForOf {
|
|
|
2583
2568
|
this.ngForOf = Number.isInteger(count) ? Array.from({ length: count }, (_, i) => i) : [];
|
|
2584
2569
|
}
|
|
2585
2570
|
}
|
|
2586
|
-
NgtRepeat.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.
|
|
2587
|
-
NgtRepeat.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.
|
|
2588
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.
|
|
2571
|
+
NgtRepeat.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRepeat, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2572
|
+
NgtRepeat.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.2", type: NgtRepeat, isStandalone: true, selector: "[ngFor][ngForRepeat]", inputs: { ngForRepeat: "ngForRepeat" }, usesInheritance: true, ngImport: i0 });
|
|
2573
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRepeat, decorators: [{
|
|
2589
2574
|
type: Directive,
|
|
2590
2575
|
args: [{ selector: '[ngFor][ngForRepeat]', standalone: true }]
|
|
2591
2576
|
}], propDecorators: { ngForRepeat: [{
|
|
@@ -2636,9 +2621,9 @@ class NgtPush {
|
|
|
2636
2621
|
this.obj = undefined;
|
|
2637
2622
|
}
|
|
2638
2623
|
}
|
|
2639
|
-
NgtPush.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.
|
|
2640
|
-
NgtPush.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.
|
|
2641
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.
|
|
2624
|
+
NgtPush.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPush, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2625
|
+
NgtPush.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.2", ngImport: i0, type: NgtPush, isStandalone: true, name: "ngtPush", pure: false });
|
|
2626
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPush, decorators: [{
|
|
2642
2627
|
type: Pipe,
|
|
2643
2628
|
args: [{ name: 'ngtPush', pure: false, standalone: true }]
|
|
2644
2629
|
}] });
|
|
@@ -2688,9 +2673,9 @@ class NgtPortalBeforeRender {
|
|
|
2688
2673
|
this.subscription?.();
|
|
2689
2674
|
}
|
|
2690
2675
|
}
|
|
2691
|
-
NgtPortalBeforeRender.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.
|
|
2692
|
-
NgtPortalBeforeRender.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.
|
|
2693
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.
|
|
2676
|
+
NgtPortalBeforeRender.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPortalBeforeRender, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2677
|
+
NgtPortalBeforeRender.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.2", type: NgtPortalBeforeRender, isStandalone: true, selector: "ngt-portal-before-render", inputs: { renderPriority: "renderPriority", parentScene: "parentScene", parentCamera: "parentCamera" }, outputs: { beforeRender: "beforeRender" }, ngImport: i0 });
|
|
2678
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPortalBeforeRender, decorators: [{
|
|
2694
2679
|
type: Directive,
|
|
2695
2680
|
args: [{
|
|
2696
2681
|
selector: 'ngt-portal-before-render',
|
|
@@ -2714,9 +2699,9 @@ class NgtPortalContent {
|
|
|
2714
2699
|
}
|
|
2715
2700
|
}
|
|
2716
2701
|
}
|
|
2717
|
-
NgtPortalContent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.
|
|
2718
|
-
NgtPortalContent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.
|
|
2719
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.
|
|
2702
|
+
NgtPortalContent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPortalContent, deps: [{ token: i0.ViewContainerRef }, { token: i0.ViewContainerRef, skipSelf: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2703
|
+
NgtPortalContent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.2", type: NgtPortalContent, isStandalone: true, selector: "ng-template[ngtPortalContent]", ngImport: i0 });
|
|
2704
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPortalContent, decorators: [{
|
|
2720
2705
|
type: Directive,
|
|
2721
2706
|
args: [{ selector: 'ng-template[ngtPortalContent]', standalone: true }]
|
|
2722
2707
|
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ViewContainerRef, decorators: [{
|
|
@@ -2824,8 +2809,8 @@ _NgtPortal_instances = new WeakSet(), _NgtPortal_inject = function _NgtPortal_in
|
|
|
2824
2809
|
...restInputsState,
|
|
2825
2810
|
};
|
|
2826
2811
|
};
|
|
2827
|
-
NgtPortal.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.
|
|
2828
|
-
NgtPortal.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.
|
|
2812
|
+
NgtPortal.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPortal, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2813
|
+
NgtPortal.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: NgtPortal, isStandalone: true, selector: "ngt-portal", inputs: { container: "container", state: "state", autoRender: "autoRender", autoRenderPriority: "autoRenderPriority" }, outputs: { beforeRender: "beforeRender" }, providers: [NgtStore], queries: [{ propertyName: "portalContentTemplate", first: true, predicate: NgtPortalContent, descendants: true, read: TemplateRef, static: true }], viewQueries: [{ propertyName: "portalContentAnchor", first: true, predicate: ["portalContentAnchor"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, ngImport: i0, template: `
|
|
2829
2814
|
<ng-container #portalContentAnchor>
|
|
2830
2815
|
<ngt-portal-before-render
|
|
2831
2816
|
*ngIf="autoRender && portalContentRendered"
|
|
@@ -2836,7 +2821,7 @@ NgtPortal.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15
|
|
|
2836
2821
|
/>
|
|
2837
2822
|
</ng-container>
|
|
2838
2823
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgtPortalBeforeRender, selector: "ngt-portal-before-render", inputs: ["renderPriority", "parentScene", "parentCamera"], outputs: ["beforeRender"] }] });
|
|
2839
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.
|
|
2824
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPortal, decorators: [{
|
|
2840
2825
|
type: Component,
|
|
2841
2826
|
args: [{
|
|
2842
2827
|
selector: 'ngt-portal',
|