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
|
@@ -57,26 +57,19 @@ function injectLoader(loaderConstructorFactory, input, extensions, onProgress) {
|
|
|
57
57
|
return urls$.pipe(map((inputs) => {
|
|
58
58
|
const loaderConstructor = loaderConstructorFactory(inputs);
|
|
59
59
|
const loader = new loaderConstructor();
|
|
60
|
-
if (extensions)
|
|
60
|
+
if (extensions)
|
|
61
61
|
extensions(loader);
|
|
62
|
-
}
|
|
63
62
|
const urls = Array.isArray(inputs) ? inputs : typeof inputs === 'string' ? [inputs] : Object.values(inputs);
|
|
64
63
|
return [
|
|
65
64
|
urls.map((url) => {
|
|
66
65
|
if (!cached.has(url)) {
|
|
67
66
|
cached.set(url, from(loader.loadAsync(url, onProgress)).pipe(tap((data) => {
|
|
68
|
-
if (data.scene)
|
|
67
|
+
if (data.scene)
|
|
69
68
|
Object.assign(data, makeObjectGraph(data.scene));
|
|
70
|
-
}
|
|
71
69
|
}), retry(2), catchError((err) => {
|
|
72
70
|
console.error(`[NGT] Error loading ${url}: ${err.message}`);
|
|
73
71
|
return of([]);
|
|
74
|
-
}), share({
|
|
75
|
-
connector: () => new ReplaySubject(1),
|
|
76
|
-
resetOnComplete: true,
|
|
77
|
-
resetOnError: true,
|
|
78
|
-
resetOnRefCountZero: true,
|
|
79
|
-
})));
|
|
72
|
+
}), share({ connector: () => new ReplaySubject(1) })));
|
|
80
73
|
}
|
|
81
74
|
return cached.get(url);
|
|
82
75
|
}),
|
|
@@ -294,19 +287,16 @@ const is = {
|
|
|
294
287
|
function checkNeedsUpdate(value) {
|
|
295
288
|
if (value !== null && is.obj(value) && 'needsUpdate' in value) {
|
|
296
289
|
value['needsUpdate'] = true;
|
|
297
|
-
if ('uniformsNeedUpdate' in value)
|
|
290
|
+
if ('uniformsNeedUpdate' in value)
|
|
298
291
|
value['uniformsNeedUpdate'] = true;
|
|
299
|
-
}
|
|
300
292
|
}
|
|
301
293
|
}
|
|
302
294
|
function checkUpdate(value) {
|
|
303
|
-
if (is.object3D(value))
|
|
295
|
+
if (is.object3D(value))
|
|
304
296
|
value.updateMatrix();
|
|
305
|
-
}
|
|
306
297
|
if (is.camera(value)) {
|
|
307
|
-
if (is.perspectiveCamera(value) || is.orthographicCamera(value))
|
|
298
|
+
if (is.perspectiveCamera(value) || is.orthographicCamera(value))
|
|
308
299
|
value.updateProjectionMatrix();
|
|
309
|
-
}
|
|
310
300
|
value.updateMatrixWorld();
|
|
311
301
|
}
|
|
312
302
|
checkNeedsUpdate(value);
|
|
@@ -319,9 +309,8 @@ function updateCamera(camera, size) {
|
|
|
319
309
|
camera.top = size.height / 2;
|
|
320
310
|
camera.bottom = size.height / -2;
|
|
321
311
|
}
|
|
322
|
-
else
|
|
312
|
+
else
|
|
323
313
|
camera.aspect = size.width / size.height;
|
|
324
|
-
}
|
|
325
314
|
camera.updateProjectionMatrix();
|
|
326
315
|
camera.updateMatrixWorld();
|
|
327
316
|
}
|
|
@@ -413,9 +402,8 @@ function applyProps(instance, props) {
|
|
|
413
402
|
value.constructor &&
|
|
414
403
|
targetProp.constructor.name === value.constructor.name) {
|
|
415
404
|
targetProp['copy'](value);
|
|
416
|
-
if (!THREE.ColorManagement && !rootState.linear && isColor)
|
|
405
|
+
if (!THREE.ColorManagement && !rootState.linear && isColor)
|
|
417
406
|
targetProp['convertSRGBToLinear']();
|
|
418
|
-
}
|
|
419
407
|
}
|
|
420
408
|
// if nothing else fits, just set the single value, ignore undefined
|
|
421
409
|
else if (value !== undefined) {
|
|
@@ -424,17 +412,14 @@ function applyProps(instance, props) {
|
|
|
424
412
|
if (!isColor && targetProp['setScalar'])
|
|
425
413
|
targetProp['setScalar'](value);
|
|
426
414
|
// layers have no copy function, copy the mask
|
|
427
|
-
else if (targetProp instanceof THREE.Layers && value instanceof THREE.Layers)
|
|
415
|
+
else if (targetProp instanceof THREE.Layers && value instanceof THREE.Layers)
|
|
428
416
|
targetProp.mask = value.mask;
|
|
429
|
-
}
|
|
430
417
|
// otherwise just set ...
|
|
431
|
-
else
|
|
418
|
+
else
|
|
432
419
|
targetProp['set'](value);
|
|
433
|
-
}
|
|
434
420
|
// auto-convert srgb
|
|
435
|
-
if (!THREE.ColorManagement && !(rootState === null || rootState === void 0 ? void 0 : rootState.linear) && isColor)
|
|
421
|
+
if (!THREE.ColorManagement && !(rootState === null || rootState === void 0 ? void 0 : rootState.linear) && isColor)
|
|
436
422
|
targetProp.convertSRGBToLinear();
|
|
437
|
-
}
|
|
438
423
|
}
|
|
439
424
|
}
|
|
440
425
|
// else just overwrite the value
|
|
@@ -527,7 +512,7 @@ class NgtRxStore extends RxState {
|
|
|
527
512
|
const originalSet = this.set.bind(this);
|
|
528
513
|
Object.defineProperty(this, 'set', {
|
|
529
514
|
get: () => {
|
|
530
|
-
// Parameters type does not do well with overloads. So we use any[] here
|
|
515
|
+
// Parameters type does not do well with overloads (RxState#set). So we use any[] here
|
|
531
516
|
return (...args) => {
|
|
532
517
|
const firstArg = args[0];
|
|
533
518
|
if (is.obj(firstArg)) {
|
|
@@ -537,7 +522,7 @@ class NgtRxStore extends RxState {
|
|
|
537
522
|
}, {});
|
|
538
523
|
return originalSet(modArgs);
|
|
539
524
|
}
|
|
540
|
-
// @ts-
|
|
525
|
+
// @ts-expect-error not sure why ...args here doesn't pass tuple check
|
|
541
526
|
return originalSet(...args);
|
|
542
527
|
};
|
|
543
528
|
},
|
|
@@ -550,9 +535,9 @@ class NgtRxStore extends RxState {
|
|
|
550
535
|
return this.hold(obs.pipe(tapEffect(sideEffectFn)));
|
|
551
536
|
}
|
|
552
537
|
}
|
|
553
|
-
NgtRxStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.
|
|
554
|
-
NgtRxStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.
|
|
555
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.
|
|
538
|
+
NgtRxStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRxStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
539
|
+
NgtRxStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRxStore });
|
|
540
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRxStore, decorators: [{
|
|
556
541
|
type: Injectable
|
|
557
542
|
}], ctorParameters: function () { return []; } });
|
|
558
543
|
|
|
@@ -593,15 +578,7 @@ class NgtStore extends NgtRxStore {
|
|
|
593
578
|
const fov = (camera.fov * Math.PI) / 180; // convert vertical fov to radians
|
|
594
579
|
const h = 2 * Math.tan(fov / 2) * distance; // visible height
|
|
595
580
|
const w = h * aspect;
|
|
596
|
-
return {
|
|
597
|
-
width: w,
|
|
598
|
-
height: h,
|
|
599
|
-
top,
|
|
600
|
-
left,
|
|
601
|
-
factor: width / w,
|
|
602
|
-
distance,
|
|
603
|
-
aspect,
|
|
604
|
-
};
|
|
581
|
+
return { width: w, height: h, top, left, factor: width / w, distance, aspect };
|
|
605
582
|
};
|
|
606
583
|
const pointer = new THREE.Vector2();
|
|
607
584
|
let performanceTimeout;
|
|
@@ -774,9 +751,8 @@ class NgtStore extends NgtRxStore {
|
|
|
774
751
|
// update projection matrix after applyprops
|
|
775
752
|
camera.updateProjectionMatrix();
|
|
776
753
|
}
|
|
777
|
-
if (!is.instance(camera))
|
|
754
|
+
if (!is.instance(camera))
|
|
778
755
|
camera = prepare(camera, { store: this });
|
|
779
|
-
}
|
|
780
756
|
stateToUpdate.camera = camera;
|
|
781
757
|
}
|
|
782
758
|
// Set up XR (one time only!)
|
|
@@ -854,9 +830,8 @@ class NgtStore extends NgtRxStore {
|
|
|
854
830
|
applyProps(gl, glOptions);
|
|
855
831
|
}
|
|
856
832
|
// Store events internally
|
|
857
|
-
if (events && !state.events.handlers)
|
|
833
|
+
if (events && !state.events.handlers)
|
|
858
834
|
stateToUpdate.events = events(this);
|
|
859
|
-
}
|
|
860
835
|
// Check performance
|
|
861
836
|
if (performance && !is.equ(performance, state.performance, shallowLoose)) {
|
|
862
837
|
stateToUpdate.performance = Object.assign(Object.assign({}, state.performance), performance);
|
|
@@ -872,9 +847,8 @@ class NgtStore extends NgtRxStore {
|
|
|
872
847
|
// Check frameloop
|
|
873
848
|
if (state.frameloop !== frameloop)
|
|
874
849
|
state.setFrameloop(frameloop);
|
|
875
|
-
if (!this.get('ready'))
|
|
850
|
+
if (!this.get('ready'))
|
|
876
851
|
this.set({ ready: true });
|
|
877
|
-
}
|
|
878
852
|
this.invalidate();
|
|
879
853
|
}
|
|
880
854
|
resize() {
|
|
@@ -905,9 +879,9 @@ class NgtStore extends NgtRxStore {
|
|
|
905
879
|
this.hold(this.select(), () => invalidate(this));
|
|
906
880
|
}
|
|
907
881
|
}
|
|
908
|
-
NgtStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.
|
|
909
|
-
NgtStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.
|
|
910
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.
|
|
882
|
+
NgtStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtStore, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
883
|
+
NgtStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtStore });
|
|
884
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtStore, decorators: [{
|
|
911
885
|
type: Injectable
|
|
912
886
|
}] });
|
|
913
887
|
function computeInitialSize(canvas, defaultSize) {
|
|
@@ -968,9 +942,9 @@ class NgtArgs {
|
|
|
968
942
|
this.view.detectChanges();
|
|
969
943
|
}
|
|
970
944
|
}
|
|
971
|
-
NgtArgs.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.
|
|
972
|
-
NgtArgs.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.
|
|
973
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.
|
|
945
|
+
NgtArgs.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtArgs, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
946
|
+
NgtArgs.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.2", type: NgtArgs, isStandalone: true, selector: "[args]", inputs: { args: "args" }, ngImport: i0 });
|
|
947
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtArgs, decorators: [{
|
|
974
948
|
type: Directive,
|
|
975
949
|
args: [{ selector: '[args]', standalone: true }]
|
|
976
950
|
}], ctorParameters: function () { return []; }, propDecorators: { args: [{
|
|
@@ -1369,7 +1343,8 @@ function attachThreeChild(parent, child) {
|
|
|
1369
1343
|
// whether the child is added to the parent with parent.add()
|
|
1370
1344
|
let added = false;
|
|
1371
1345
|
// assign store on child if not already exist
|
|
1372
|
-
|
|
1346
|
+
// or child store is the parent of parent store
|
|
1347
|
+
if (!cLS.store || cLS.store === pLS.store.get('previousStore')) {
|
|
1373
1348
|
cLS.store = pLS.store;
|
|
1374
1349
|
}
|
|
1375
1350
|
if (cLS.attach) {
|
|
@@ -1847,7 +1822,12 @@ class NgtRendererStore {
|
|
|
1847
1822
|
let i = this.portals.length - 1;
|
|
1848
1823
|
while (i >= 0) {
|
|
1849
1824
|
// loop through the portal state backwards to find the closest NgtStore
|
|
1850
|
-
const
|
|
1825
|
+
const portal = this.portals[i];
|
|
1826
|
+
if (portal.__ngt_renderer__[3 /* NgtRendererClassId.destroyed */]) {
|
|
1827
|
+
i--;
|
|
1828
|
+
continue;
|
|
1829
|
+
}
|
|
1830
|
+
const injector = portal.__ngt_renderer__[13 /* NgtRendererClassId.injectorFactory */]();
|
|
1851
1831
|
if (!injector) {
|
|
1852
1832
|
i--;
|
|
1853
1833
|
continue;
|
|
@@ -1871,31 +1851,47 @@ class NgtRendererFactory {
|
|
|
1871
1851
|
this.store = inject(NgtStore);
|
|
1872
1852
|
this.catalogue = inject(NGT_CATALOGUE);
|
|
1873
1853
|
this.compoundPrefixes = inject(NGT_COMPOUND_PREFIXES);
|
|
1874
|
-
this.
|
|
1875
|
-
store: this.store,
|
|
1876
|
-
cdr: this.cdr,
|
|
1877
|
-
compoundPrefixes: this.compoundPrefixes,
|
|
1878
|
-
});
|
|
1854
|
+
this.rendererMap = new Map();
|
|
1879
1855
|
}
|
|
1880
1856
|
createRenderer(hostElement, type) {
|
|
1881
|
-
|
|
1882
|
-
if (!
|
|
1883
|
-
|
|
1884
|
-
|
|
1857
|
+
const domRenderer = this.domRendererFactory.createRenderer(hostElement, type);
|
|
1858
|
+
if (!type)
|
|
1859
|
+
return domRenderer;
|
|
1860
|
+
let renderer = this.rendererMap.get(type.id);
|
|
1861
|
+
if (renderer)
|
|
1862
|
+
return renderer;
|
|
1863
|
+
if (!hostElement) {
|
|
1864
|
+
const store = new NgtRendererStore({
|
|
1865
|
+
store: this.store,
|
|
1866
|
+
cdr: this.cdr,
|
|
1867
|
+
compoundPrefixes: this.compoundPrefixes,
|
|
1868
|
+
});
|
|
1869
|
+
renderer = new NgtRenderer(domRenderer, store, this.catalogue, true);
|
|
1870
|
+
this.rendererMap.set(type.id, renderer);
|
|
1871
|
+
}
|
|
1872
|
+
if (!renderer) {
|
|
1873
|
+
const store = new NgtRendererStore({
|
|
1874
|
+
store: this.store,
|
|
1875
|
+
cdr: this.cdr,
|
|
1876
|
+
compoundPrefixes: this.compoundPrefixes,
|
|
1877
|
+
});
|
|
1878
|
+
renderer = new NgtRenderer(domRenderer, store, this.catalogue);
|
|
1879
|
+
this.rendererMap.set(type.id, renderer);
|
|
1885
1880
|
}
|
|
1886
|
-
return
|
|
1881
|
+
return renderer;
|
|
1887
1882
|
}
|
|
1888
1883
|
}
|
|
1889
|
-
NgtRendererFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.
|
|
1890
|
-
NgtRendererFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.
|
|
1891
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.
|
|
1884
|
+
NgtRendererFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRendererFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1885
|
+
NgtRendererFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRendererFactory });
|
|
1886
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRendererFactory, decorators: [{
|
|
1892
1887
|
type: Injectable
|
|
1893
1888
|
}] });
|
|
1894
1889
|
class NgtRenderer {
|
|
1895
|
-
constructor(domRenderer, store, catalogue) {
|
|
1890
|
+
constructor(domRenderer, store, catalogue, root = false) {
|
|
1896
1891
|
this.domRenderer = domRenderer;
|
|
1897
1892
|
this.store = store;
|
|
1898
1893
|
this.catalogue = catalogue;
|
|
1894
|
+
this.root = root;
|
|
1899
1895
|
this.first = false;
|
|
1900
1896
|
this.createText = this.domRenderer.createText.bind(this.domRenderer);
|
|
1901
1897
|
this.destroy = this.domRenderer.destroy.bind(this.domRenderer);
|
|
@@ -1912,7 +1908,7 @@ class NgtRenderer {
|
|
|
1912
1908
|
createElement(name, namespace) {
|
|
1913
1909
|
const element = this.domRenderer.createElement(name, namespace);
|
|
1914
1910
|
// on first pass, we return the Root Scene as the root node
|
|
1915
|
-
if (!this.first) {
|
|
1911
|
+
if (this.root && !this.first) {
|
|
1916
1912
|
this.first = true;
|
|
1917
1913
|
return this.store.createNode('three', this.store.rootScene);
|
|
1918
1914
|
}
|
|
@@ -1974,7 +1970,7 @@ class NgtRenderer {
|
|
|
1974
1970
|
}
|
|
1975
1971
|
this.store.setParent(newChild, parent);
|
|
1976
1972
|
this.store.addChild(parent, newChild);
|
|
1977
|
-
// if new
|
|
1973
|
+
// if new child is a portal
|
|
1978
1974
|
if (newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'portal') {
|
|
1979
1975
|
this.store.processPortalContainer(newChild);
|
|
1980
1976
|
if (newChild.__ngt_renderer__[12 /* NgtRendererClassId.portalContainer */]) {
|
|
@@ -2035,25 +2031,23 @@ class NgtRenderer {
|
|
|
2035
2031
|
this.store.setCompound(parent, newChild);
|
|
2036
2032
|
}
|
|
2037
2033
|
}
|
|
2038
|
-
|
|
2034
|
+
const shouldFindGrandparentInstance =
|
|
2035
|
+
// if child is three but haven't been attached to a parent yet
|
|
2036
|
+
(newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three' && !getLocalState(newChild).parent) ||
|
|
2037
|
+
// or both parent and child are DOM elements
|
|
2038
|
+
(parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'dom' &&
|
|
2039
|
+
newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'dom');
|
|
2040
|
+
if (shouldFindGrandparentInstance) {
|
|
2039
2041
|
// we'll try to get the grandparent instance here so that we can run appendChild with both instances
|
|
2040
2042
|
const closestGrandparentInstance = this.store.getClosestParentWithInstance(parent);
|
|
2041
2043
|
if (closestGrandparentInstance) {
|
|
2042
2044
|
this.appendChild(closestGrandparentInstance, newChild);
|
|
2043
2045
|
}
|
|
2044
|
-
return;
|
|
2045
|
-
}
|
|
2046
|
-
if (parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'dom' &&
|
|
2047
|
-
newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'dom') {
|
|
2048
|
-
const closestGrandparentInstance = this.store.getClosestParentWithInstance(parent);
|
|
2049
|
-
if (closestGrandparentInstance) {
|
|
2050
|
-
this.appendChild(closestGrandparentInstance, newChild);
|
|
2051
|
-
}
|
|
2052
2046
|
}
|
|
2053
2047
|
}
|
|
2054
2048
|
insertBefore(parent, newChild
|
|
2055
2049
|
// TODO we might need these?
|
|
2056
|
-
// refChild: NgtRendererNode
|
|
2050
|
+
// refChild: NgtRendererNode
|
|
2057
2051
|
// isMove?: boolean | undefined
|
|
2058
2052
|
) {
|
|
2059
2053
|
if (!parent.__ngt_renderer__)
|
|
@@ -2319,9 +2313,7 @@ class NgtCanvas extends NgtRxStore {
|
|
|
2319
2313
|
// set rootStateMap
|
|
2320
2314
|
rootStateMap.set(this.glCanvas.nativeElement, this.store);
|
|
2321
2315
|
// subscribe to store to listen for ready state
|
|
2322
|
-
this.hold(this.store.select('ready').pipe(filter((ready) => ready)), () =>
|
|
2323
|
-
this.storeReady();
|
|
2324
|
-
});
|
|
2316
|
+
this.hold(this.store.select('ready').pipe(filter((ready) => ready)), () => this.storeReady());
|
|
2325
2317
|
}
|
|
2326
2318
|
onResize({ width, height }) {
|
|
2327
2319
|
if (width > 0 && height > 0) {
|
|
@@ -2356,9 +2348,8 @@ class NgtCanvas extends NgtRxStore {
|
|
|
2356
2348
|
this.cdr.detectChanges();
|
|
2357
2349
|
}
|
|
2358
2350
|
// render
|
|
2359
|
-
if (this.glRef)
|
|
2351
|
+
if (this.glRef)
|
|
2360
2352
|
this.glRef.destroy();
|
|
2361
|
-
}
|
|
2362
2353
|
requestAnimationFrame(() => {
|
|
2363
2354
|
this.glEnvInjector = createEnvironmentInjector([
|
|
2364
2355
|
provideNgtRenderer({
|
|
@@ -2377,12 +2368,10 @@ class NgtCanvas extends NgtRxStore {
|
|
|
2377
2368
|
});
|
|
2378
2369
|
}
|
|
2379
2370
|
ngOnDestroy() {
|
|
2380
|
-
if (this.glRef)
|
|
2371
|
+
if (this.glRef)
|
|
2381
2372
|
this.glRef.destroy();
|
|
2382
|
-
|
|
2383
|
-
if (this.glEnvInjector) {
|
|
2373
|
+
if (this.glEnvInjector)
|
|
2384
2374
|
this.glEnvInjector.destroy();
|
|
2385
|
-
}
|
|
2386
2375
|
injectNgtLoader.destroy();
|
|
2387
2376
|
super.ngOnDestroy();
|
|
2388
2377
|
}
|
|
@@ -2395,13 +2384,13 @@ class NgtCanvas extends NgtRxStore {
|
|
|
2395
2384
|
};
|
|
2396
2385
|
}
|
|
2397
2386
|
}
|
|
2398
|
-
NgtCanvas.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.
|
|
2399
|
-
NgtCanvas.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.
|
|
2387
|
+
NgtCanvas.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtCanvas, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2388
|
+
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: `
|
|
2400
2389
|
<div (ngxResize)="onResize($event)" style="height: 100%; width: 100%;">
|
|
2401
2390
|
<canvas #glCanvas style="display: block;"></canvas>
|
|
2402
2391
|
</div>
|
|
2403
2392
|
`, 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"] }] });
|
|
2404
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.
|
|
2393
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtCanvas, decorators: [{
|
|
2405
2394
|
type: Component,
|
|
2406
2395
|
args: [{ selector: 'ngt-canvas', standalone: true, template: `
|
|
2407
2396
|
<div (ngxResize)="onResize($event)" style="height: 100%; width: 100%;">
|
|
@@ -2475,8 +2464,7 @@ function injectNgtDestroy(cb) {
|
|
|
2475
2464
|
return { destroy$, cdr };
|
|
2476
2465
|
}
|
|
2477
2466
|
catch (e) {
|
|
2478
|
-
|
|
2479
|
-
return {};
|
|
2467
|
+
throw new Error(`[NGT] injectNgtDestroy is being called outside of Constructor Context`);
|
|
2480
2468
|
}
|
|
2481
2469
|
}
|
|
2482
2470
|
|
|
@@ -2493,10 +2481,7 @@ function injectBeforeRender(cb, priority = 0) {
|
|
|
2493
2481
|
}
|
|
2494
2482
|
|
|
2495
2483
|
function injectNgtRef(initialValue = null) {
|
|
2496
|
-
|
|
2497
|
-
if (is.ref(initialValue)) {
|
|
2498
|
-
ref = initialValue;
|
|
2499
|
-
}
|
|
2484
|
+
const ref = is.ref(initialValue) ? initialValue : new ElementRef(initialValue);
|
|
2500
2485
|
let lastValue = ref.nativeElement;
|
|
2501
2486
|
const cdRefs = [];
|
|
2502
2487
|
const ref$ = new BehaviorSubject(lastValue);
|
|
@@ -2546,7 +2531,7 @@ function injectNgtRef(initialValue = null) {
|
|
|
2546
2531
|
}
|
|
2547
2532
|
// during creation phase, 'context' on ViewRef will be null
|
|
2548
2533
|
// we check the "context" to avoid running detectChanges during this phase.
|
|
2549
|
-
//
|
|
2534
|
+
// because there's nothing to check
|
|
2550
2535
|
if (cd['context']) {
|
|
2551
2536
|
cd.detectChanges();
|
|
2552
2537
|
}
|
|
@@ -2563,9 +2548,9 @@ class NgtRepeat extends NgForOf {
|
|
|
2563
2548
|
this.ngForOf = Number.isInteger(count) ? Array.from({ length: count }, (_, i) => i) : [];
|
|
2564
2549
|
}
|
|
2565
2550
|
}
|
|
2566
|
-
NgtRepeat.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.
|
|
2567
|
-
NgtRepeat.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.
|
|
2568
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.
|
|
2551
|
+
NgtRepeat.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRepeat, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2552
|
+
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 });
|
|
2553
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRepeat, decorators: [{
|
|
2569
2554
|
type: Directive,
|
|
2570
2555
|
args: [{ selector: '[ngFor][ngForRepeat]', standalone: true }]
|
|
2571
2556
|
}], propDecorators: { ngForRepeat: [{
|
|
@@ -2616,9 +2601,9 @@ class NgtPush {
|
|
|
2616
2601
|
this.obj = undefined;
|
|
2617
2602
|
}
|
|
2618
2603
|
}
|
|
2619
|
-
NgtPush.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.
|
|
2620
|
-
NgtPush.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.
|
|
2621
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.
|
|
2604
|
+
NgtPush.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPush, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2605
|
+
NgtPush.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.2", ngImport: i0, type: NgtPush, isStandalone: true, name: "ngtPush", pure: false });
|
|
2606
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPush, decorators: [{
|
|
2622
2607
|
type: Pipe,
|
|
2623
2608
|
args: [{ name: 'ngtPush', pure: false, standalone: true }]
|
|
2624
2609
|
}] });
|
|
@@ -2669,9 +2654,9 @@ class NgtPortalBeforeRender {
|
|
|
2669
2654
|
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
2670
2655
|
}
|
|
2671
2656
|
}
|
|
2672
|
-
NgtPortalBeforeRender.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.
|
|
2673
|
-
NgtPortalBeforeRender.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.
|
|
2674
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.
|
|
2657
|
+
NgtPortalBeforeRender.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPortalBeforeRender, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2658
|
+
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 });
|
|
2659
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPortalBeforeRender, decorators: [{
|
|
2675
2660
|
type: Directive,
|
|
2676
2661
|
args: [{
|
|
2677
2662
|
selector: 'ngt-portal-before-render',
|
|
@@ -2695,9 +2680,9 @@ class NgtPortalContent {
|
|
|
2695
2680
|
}
|
|
2696
2681
|
}
|
|
2697
2682
|
}
|
|
2698
|
-
NgtPortalContent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.
|
|
2699
|
-
NgtPortalContent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.
|
|
2700
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.
|
|
2683
|
+
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 });
|
|
2684
|
+
NgtPortalContent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.2", type: NgtPortalContent, isStandalone: true, selector: "ng-template[ngtPortalContent]", ngImport: i0 });
|
|
2685
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPortalContent, decorators: [{
|
|
2701
2686
|
type: Directive,
|
|
2702
2687
|
args: [{ selector: 'ng-template[ngtPortalContent]', standalone: true }]
|
|
2703
2688
|
}], ctorParameters: function () {
|
|
@@ -2784,8 +2769,8 @@ _NgtPortal_instances = new WeakSet(), _NgtPortal_inject = function _NgtPortal_in
|
|
|
2784
2769
|
}
|
|
2785
2770
|
return Object.assign(Object.assign(Object.assign({}, intersect), { scene: is.ref(inputs.container) ? inputs.container.nativeElement : inputs.container, raycaster: this.raycaster, pointer: this.pointer, previousStore: this.parentStore, events: Object.assign(Object.assign(Object.assign({}, rootState.events), ((injectState === null || injectState === void 0 ? void 0 : injectState.events) || {})), events), size: Object.assign(Object.assign({}, rootState.size), size), viewport: Object.assign(Object.assign({}, rootState.viewport), (viewport || {})) }), restInputsState);
|
|
2786
2771
|
};
|
|
2787
|
-
NgtPortal.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.
|
|
2788
|
-
NgtPortal.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.
|
|
2772
|
+
NgtPortal.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPortal, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2773
|
+
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: `
|
|
2789
2774
|
<ng-container #portalContentAnchor>
|
|
2790
2775
|
<ngt-portal-before-render
|
|
2791
2776
|
*ngIf="autoRender && portalContentRendered"
|
|
@@ -2796,7 +2781,7 @@ NgtPortal.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15
|
|
|
2796
2781
|
/>
|
|
2797
2782
|
</ng-container>
|
|
2798
2783
|
`, 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"] }] });
|
|
2799
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.
|
|
2784
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPortal, decorators: [{
|
|
2800
2785
|
type: Component,
|
|
2801
2786
|
args: [{
|
|
2802
2787
|
selector: 'ngt-portal',
|