From 3fd9c55b3a81d079df91132d71d01bc6be880a95 Mon Sep 17 00:00:00 2001 From: johnshaughnessy <johnfshaughnessy@gmail.com> Date: Tue, 4 Sep 2018 15:26:36 -0700 Subject: [PATCH] Remove event listener for fullscreen when exiting the scene. --- src/hub.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hub.js b/src/hub.js index 2d56387dd..bef3e16d1 100644 --- a/src/hub.js +++ b/src/hub.js @@ -188,6 +188,10 @@ function mountUI(scene, props = {}) { ); } +function requestFullscreen() { + if (screenfull.enabled && !screenfull.isFullscreen) screenfull.request(); +} + const onReady = async () => { const scene = document.querySelector("a-scene"); const hubChannel = new HubChannel(store); @@ -232,6 +236,7 @@ const onReady = async () => { } document.body.removeChild(scene); } + document.body.removeEventListener("touchend", requestFullscreen); }; const enterScene = async (mediaStream, enterInVR, hubId) => { @@ -246,9 +251,7 @@ const onReady = async () => { if (enterInVR) { scene.enterVR(); } else if (AFRAME.utils.device.isMobile()) { - document.body.addEventListener("touchend", () => { - if (screenfull.enabled && !screenfull.isFullscreen) screenfull.request(); - }); + document.body.addEventListener("touchend", requestFullscreen); } AFRAME.registerInputActions(inGameActions, "default"); -- GitLab