From de6827776283d06eab889790a238979fb8156a3e Mon Sep 17 00:00:00 2001
From: Zero~Informatique
Date: Sat, 3 Jul 2021 01:36:32 +0200
Subject: viewer: document.fullscreen is deprecated, use
 document.fullscreenElement instead

---
 viewer/src/views/MainLayout.vue | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

(limited to 'viewer/src/views/MainLayout.vue')

diff --git a/viewer/src/views/MainLayout.vue b/viewer/src/views/MainLayout.vue
index 13b17b4..eee813f 100644
--- a/viewer/src/views/MainLayout.vue
+++ b/viewer/src/views/MainLayout.vue
@@ -95,14 +95,19 @@ export default class MainLayout extends Vue {
     });
   }
 
+  isFullscreenActive(): boolean {
+    return Boolean(document.fullscreenElement);
+  }
+
   @Watch("$uiStore.fullscreen")
   applyFullscreen(fullscreen: boolean) {
-    if (fullscreen && !document.fullscreen) document.body.requestFullscreen();
-    else if (document.fullscreen) document.exitFullscreen();
+    const isFullscreenActive = this.isFullscreenActive();
+    if (fullscreen && !isFullscreenActive) document.body.requestFullscreen();
+    else if (isFullscreenActive) document.exitFullscreen();
   }
 
   onFullscreenChange() {
-    this.$uiStore.toggleFullscreen(document.fullscreen);
+    this.$uiStore.toggleFullscreen(this.isFullscreenActive());
   }
 }
 </script>
-- 
cgit v1.2.3

