From d41a885e32473935d03eb1b260061c89eef66b1e Mon Sep 17 00:00:00 2001
From: Zero~Informatique
Date: Tue, 28 Apr 2020 03:27:01 +0200
Subject: viewer: fullscreen on double-click is now true fullscreen. Also works
on web-app
---
viewer/public/index.html | 2 +-
viewer/src/views/MainLayout.vue | 15 +++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
(limited to 'viewer')
diff --git a/viewer/public/index.html b/viewer/public/index.html
index cadbc72..4b7e26d 100644
--- a/viewer/public/index.html
+++ b/viewer/public/index.html
@@ -24,7 +24,7 @@
-
+
diff --git a/viewer/src/views/MainLayout.vue b/viewer/src/views/MainLayout.vue
index c09e99a..bcd2249 100644
--- a/viewer/src/views/MainLayout.vue
+++ b/viewer/src/views/MainLayout.vue
@@ -49,6 +49,11 @@ export default class MainLayout extends Vue {
mounted() {
history.replaceState({ ldgallery: "ENTRYPOINT" }, "");
this.fetchGalleryItems();
+ document.body.addEventListener("fullscreenchange", this.onFullscreenChange);
+ }
+
+ destroyed() {
+ document.body.removeEventListener("fullscreenchange", this.onFullscreenChange);
}
@Watch("$route")
@@ -77,6 +82,16 @@ export default class MainLayout extends Vue {
onAction: this.fetchGalleryItems,
});
}
+
+ @Watch("$uiStore.fullscreen")
+ applyFullscreen(fullscreen: boolean) {
+ if (fullscreen && !document.fullscreen) document.body.requestFullscreen();
+ else if (document.fullscreen) document.exitFullscreen();
+ }
+
+ onFullscreenChange() {
+ this.$uiStore.toggleFullscreen(document.fullscreen);
+ }
}
--
cgit v1.2.3