File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
libs/soba/cameras/src/lib Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -75,8 +75,19 @@ export class NgtsPerspectiveCamera {
7575 constructor ( ) {
7676 extend ( { PerspectiveCamera, Group } ) ;
7777
78+ effect ( ( onCleanup ) => {
79+ const makeDefault = this . makeDefault ( ) ;
80+ if ( ! makeDefault ) return ;
81+
82+ const camera = this . cameraRef ( ) . nativeElement ;
83+ const oldCam = this . store . snapshot . camera ;
84+ this . store . update ( { camera } ) ;
85+ onCleanup ( ( ) => this . store . update ( ( ) => ( { camera : oldCam } ) ) ) ;
86+ } ) ;
87+
7888 effect ( ( ) => {
79- this . cameraRef ( ) . nativeElement . updateProjectionMatrix ( ) ;
89+ const camera = this . cameraRef ( ) . nativeElement ;
90+ camera . updateProjectionMatrix ( ) ;
8091 } ) ;
8192
8293 effect ( ( ) => {
@@ -91,15 +102,6 @@ export class NgtsPerspectiveCamera {
91102 camera . updateProjectionMatrix ( ) ;
92103 } ) ;
93104
94- effect ( ( onCleanup ) => {
95- const makeDefault = this . makeDefault ( ) ;
96- if ( ! makeDefault ) return ;
97-
98- const oldCam = this . store . snapshot . camera ;
99- this . store . update ( { camera : this . cameraRef ( ) . nativeElement } ) ;
100- onCleanup ( ( ) => this . store . update ( ( ) => ( { camera : oldCam } ) ) ) ;
101- } ) ;
102-
103105 let count = 0 ;
104106 let oldEnvMap : THREE . Color | THREE . Texture | null = null ;
105107 injectBeforeRender ( ( { gl, scene } ) => {
You can’t perform that action at this time.
0 commit comments