repo: janusweb action: commit revision: path_from: revision_from: d9ddb410b637ab93acbeb5335c21720561632635: path_to: revision_to:
commit d9ddb410b637ab93acbeb5335c21720561632635 Author: James BaicoianuDate: Thu Oct 17 17:28:30 2024 -0700 Only enter fullscreen / VR when touch event is on canvas diff --git a/scripts/client.js b/scripts/client.js
--- a/scripts/client.js
+++ b/scripts/client.js
@@ -142,11 +142,13 @@ elation.require(['elements.elements', 'elements', 'engine.engine', 'engine.asset
window.scrollTo(0, 1);
});
window.addEventListener('touchend', ev => {
- // FIXME - useragent hack isn't the best way of handling this, but it beats getting stuck in non-immersive fullscreen mode while in a VR headset
- if (navigator.userAgent.indexOf('OculusBrowser') != -1) {
- this.startXR();
- } else if (!this.view.isFullscreen()) {
- this.toggleFullscreen({value: 1});
+ if (ev.target == this.engine.systems.render.renderer.domElement) {
+ // FIXME - useragent hack isn't the best way of handling this, but it beats getting stuck in non-immersive fullscreen mode while in a VR headset
+ if (navigator.userAgent.indexOf('OculusBrowser') != -1) {
+ this.startXR();
+ } else if (!this.view.isFullscreen()) {
+ this.toggleFullscreen({value: 1});
+ }
}
});
}
-----END OF PAGE-----