File tree 3 files changed +15
-7
lines changed
3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ export class EnvironmentControls extends EventDispatcher {
83
83
this . adjustHeight = true ;
84
84
85
85
// internal state
86
- this . pointerTracker = new PointerTracker ( domElement ) ;
86
+ this . pointerTracker = new PointerTracker ( ) ;
87
87
this . needsUpdate = false ;
88
88
this . actionHeightOffset = 0 ;
89
89
@@ -112,9 +112,9 @@ export class EnvironmentControls extends EventDispatcher {
112
112
this . _upInitialized = false ;
113
113
114
114
// init
115
- this . attach ( domElement ) ;
116
- this . setCamera ( camera ) ;
117
- this . setScene ( scene ) ;
115
+ if ( domElement ) this . attach ( domElement ) ;
116
+ if ( camera ) this . setCamera ( camera ) ;
117
+ if ( scene ) this . setScene ( scene ) ;
118
118
119
119
}
120
120
@@ -444,6 +444,8 @@ export class EnvironmentControls extends EventDispatcher {
444
444
445
445
detach ( ) {
446
446
447
+ this . domElement = null ;
448
+
447
449
if ( this . _detachCallback ) {
448
450
449
451
this . _detachCallback ( ) ;
@@ -493,7 +495,7 @@ export class EnvironmentControls extends EventDispatcher {
493
495
494
496
update ( ) {
495
497
496
- if ( ! this . enabled ) {
498
+ if ( ! this . enabled || ! this . camera ) {
497
499
498
500
return ;
499
501
Original file line number Diff line number Diff line change @@ -112,6 +112,12 @@ export class GlobeControls extends EnvironmentControls {
112
112
113
113
update ( ) {
114
114
115
+ if ( ! this . tilesGroup || ! this . camera ) {
116
+
117
+ return ;
118
+
119
+ }
120
+
115
121
super . update ( ) ;
116
122
117
123
const {
Original file line number Diff line number Diff line change @@ -2,9 +2,9 @@ import { Vector2 } from 'three';
2
2
3
3
export class PointerTracker {
4
4
5
- constructor ( domElement ) {
5
+ constructor ( ) {
6
6
7
- this . domElement = domElement ;
7
+ this . domElement = null ;
8
8
this . buttons = 0 ;
9
9
this . pointerType = null ;
10
10
this . pointerOrder = [ ] ;
You can’t perform that action at this time.
0 commit comments