|
9 | 9 | contentChild, |
10 | 10 | effect, |
11 | 11 | input, |
12 | | - untracked, |
13 | 12 | viewChild, |
14 | 13 | } from '@angular/core'; |
15 | 14 | import { NgtThreeElements, extend, injectBeforeRender, injectStore, omit, pick } from 'angular-three'; |
@@ -86,13 +85,15 @@ export class NgtsOrthographicCamera { |
86 | 85 |
|
87 | 86 | private store = injectStore(); |
88 | 87 |
|
89 | | - private camera = this.store.camera; |
90 | | - private size = this.store.size; |
| 88 | + private _left = pick(this.options, 'left'); |
| 89 | + private _right = pick(this.options, 'right'); |
| 90 | + private _top = pick(this.options, 'top'); |
| 91 | + private _bottom = pick(this.options, 'bottom'); |
91 | 92 |
|
92 | | - protected left = computed(() => this.options().left ?? this.size().width / -2); |
93 | | - protected right = computed(() => this.options().right ?? this.size().width / 2); |
94 | | - protected top = computed(() => this.options().top ?? this.size().height / 2); |
95 | | - protected bottom = computed(() => this.options().bottom ?? this.size().height / -2); |
| 93 | + protected left = computed(() => this._left() ?? this.store.size.width() / -2); |
| 94 | + protected right = computed(() => this._right() ?? this.store.size.width() / 2); |
| 95 | + protected top = computed(() => this._top() ?? this.store.size.height() / 2); |
| 96 | + protected bottom = computed(() => this._bottom() ?? this.store.size.height() / -2); |
96 | 97 |
|
97 | 98 | private manual = pick(this.options, 'manual'); |
98 | 99 | private makeDefault = pick(this.options, 'makeDefault'); |
@@ -120,7 +121,7 @@ export class NgtsOrthographicCamera { |
120 | 121 | const makeDefault = this.makeDefault(); |
121 | 122 | if (!makeDefault) return; |
122 | 123 |
|
123 | | - const oldCam = untracked(this.camera); |
| 124 | + const oldCam = this.store.snapshot.camera; |
124 | 125 | this.store.update({ camera: this.cameraRef().nativeElement }); |
125 | 126 | onCleanup(() => this.store.update(() => ({ camera: oldCam }))); |
126 | 127 | }); |
|
0 commit comments