diff options
author | Zero~Informatique | 2021-07-03 01:36:32 +0200 |
---|---|---|
committer | zeroinformatique | 2021-07-03 18:52:53 +0200 |
commit | de6827776283d06eab889790a238979fb8156a3e (patch) | |
tree | f1e3fe0e6365fdb727da486b3e9372b4b5ab5a04 | |
parent | b6605e2c4ee73ac8b994624098344db5e44ac07d (diff) | |
download | ldgallery-de6827776283d06eab889790a238979fb8156a3e.tar.gz |
viewer: document.fullscreen is deprecated, use document.fullscreenElement instead
-rw-r--r-- | viewer/src/views/MainLayout.vue | 11 |
1 files changed, 8 insertions, 3 deletions
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 { | |||
95 | }); | 95 | }); |
96 | } | 96 | } |
97 | 97 | ||
98 | isFullscreenActive(): boolean { | ||
99 | return Boolean(document.fullscreenElement); | ||
100 | } | ||
101 | |||
98 | @Watch("$uiStore.fullscreen") | 102 | @Watch("$uiStore.fullscreen") |
99 | applyFullscreen(fullscreen: boolean) { | 103 | applyFullscreen(fullscreen: boolean) { |
100 | if (fullscreen && !document.fullscreen) document.body.requestFullscreen(); | 104 | const isFullscreenActive = this.isFullscreenActive(); |
101 | else if (document.fullscreen) document.exitFullscreen(); | 105 | if (fullscreen && !isFullscreenActive) document.body.requestFullscreen(); |
106 | else if (isFullscreenActive) document.exitFullscreen(); | ||
102 | } | 107 | } |
103 | 108 | ||
104 | onFullscreenChange() { | 109 | onFullscreenChange() { |
105 | this.$uiStore.toggleFullscreen(document.fullscreen); | 110 | this.$uiStore.toggleFullscreen(this.isFullscreenActive()); |
106 | } | 111 | } |
107 | } | 112 | } |
108 | </script> | 113 | </script> |