Commit 7b07305 1 parent bc04310 commit 7b07305 Copy full SHA for 7b07305
File tree 1 file changed +15
-0
lines changed
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -81,9 +81,24 @@ WebviewPlugin.prototype.enable = function() {
81
81
renderWebGL ( sceneWebGL ) ;
82
82
} ;
83
83
this . originalRender = renderWebGL ;
84
+
85
+ var self = this ;
86
+
87
+ window . addEventListener ( 'click' , this . onClick = function ( ev ) {
88
+ // click anywhere outside of iframe to exit TODO: what if it fills the entire screen? (alternate escape hatch)
89
+ // (we won't receive click events for the iframe here)
90
+ // TODO: register on WebGL canvas element instead?
91
+ // tried this.game.view.renderer.domElement but didn't receive events
92
+
93
+ if ( document . getElementById ( 'voxel-webview' ) . parentElement . parentElement . style . zIndex === '0' ) {
94
+ document . getElementById ( 'voxel-webview' ) . parentElement . parentElement . style . zIndex = '-1' ;
95
+ self . game . interact . request ( ) ;
96
+ }
97
+ } ) ;
84
98
} ;
85
99
86
100
WebviewPlugin . prototype . disable = function ( ) {
87
101
this . game . view . render = this . originalRender ;
102
+ window . removeEventListener ( 'click' , this . onClick ) ;
88
103
} ;
89
104
You can’t perform that action at this time.
0 commit comments