File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,8 @@ import {
4747 ViewportMode
4848} from './view'
4949
50+ import { VisibilityService } from './visibility'
51+
5052export class DeviceState {
5153 viewport ?:CanvasViewport ;
5254 subviews ?:SerializedSubviewList ;
@@ -145,7 +147,8 @@ export class DeviceService {
145147 constructor (
146148 protected sessionService :SessionService ,
147149 protected contextService :ContextService ,
148- protected viewService :ViewService
150+ protected viewService :ViewService ,
151+ protected visibilityService :VisibilityService
149152 ) {
150153 sessionService . manager . on [ 'ar.device.state' ] =
151154 sessionService . manager . on [ 'ar.device.frameState' ] = this . _onDeviceState . bind ( this ) ;
@@ -217,11 +220,9 @@ export class DeviceService {
217220 // });
218221 // }
219222
220- this . startUpdates ( ) ;
221- this . sessionService . manager . closeEvent . addEventListener ( ( ) => {
222- this . stopUpdates ( ) ;
223- } )
224-
223+ this . visibilityService . showEvent . addEventListener ( ( ) => this . startUpdates ( ) ) ;
224+ this . visibilityService . hideEvent . addEventListener ( ( ) => this . stopUpdates ( ) ) ;
225+
225226 this . _setupVRPresentChangeHandler ( ) ;
226227 }
227228
You can’t perform that action at this time.
0 commit comments