Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 52a2403

Browse files
committed
refactor(soba/cameras): bring makeDefault effect on top for orthographic
1 parent 14a8904 commit 52a2403

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

libs/soba/cameras/src/lib/orthographic-camera.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,15 @@ export class NgtsOrthographicCamera {
103103
constructor() {
104104
extend({ OrthographicCamera, Group });
105105

106+
effect((onCleanup) => {
107+
const makeDefault = this.makeDefault();
108+
if (!makeDefault) return;
109+
110+
const oldCam = this.store.snapshot.camera;
111+
this.store.update({ camera: this.cameraRef().nativeElement });
112+
onCleanup(() => this.store.update(() => ({ camera: oldCam })));
113+
});
114+
106115
effect(() => {
107116
this.cameraRef().nativeElement.updateProjectionMatrix();
108117
});
@@ -115,15 +124,6 @@ export class NgtsOrthographicCamera {
115124
camera.updateProjectionMatrix();
116125
});
117126

118-
effect((onCleanup) => {
119-
const makeDefault = this.makeDefault();
120-
if (!makeDefault) return;
121-
122-
const oldCam = this.store.snapshot.camera;
123-
this.store.update({ camera: this.cameraRef().nativeElement });
124-
onCleanup(() => this.store.update(() => ({ camera: oldCam })));
125-
});
126-
127127
let count = 0;
128128
let oldEnvMap: THREE.Color | THREE.Texture | null = null;
129129
injectBeforeRender(({ gl, scene }) => {

0 commit comments

Comments
 (0)