# HG changeset patch
# User Edouard Tisserant
# Date 1630056692 -7200
# Node ID 8b45d8494fae3895fb794906e7ab4d73d20a9723
# Parent e6131894be1deb5acd8ac597b8165265ae5941fc
SVGHMI: Allow toggling fulscreen mode my right click or long press.
diff -r e6131894be1d -r 8b45d8494fae svghmi/gen_index_xhtml.xslt
--- a/svghmi/gen_index_xhtml.xslt Tue Aug 24 11:12:41 2021 +0200
+++ b/svghmi/gen_index_xhtml.xslt Fri Aug 27 11:31:32 2021 +0200
@@ -8226,12 +8226,38 @@
+ function toggleFullscreen() {
+
+ let elem = document.documentElement;
+
+
+
+ if (!document.fullscreenElement) {
+
+ elem.requestFullscreen().catch(err => {
+
+ console.log("Error attempting to enable full-screen mode: "+err.message+" ("+err.name+")");
+
+ });
+
+ } else {
+
+ document.exitFullscreen();
+
+ }
+
+ }
+
+
+
function prepare_svg() {
// prevents context menu from appearing on right click and long touch
document.body.addEventListener('contextmenu', e => {
+ toggleFullscreen();
+
e.preventDefault();
});
diff -r e6131894be1d -r 8b45d8494fae svghmi/svghmi.js
--- a/svghmi/svghmi.js Tue Aug 24 11:12:41 2021 +0200
+++ b/svghmi/svghmi.js Fri Aug 27 11:31:32 2021 +0200
@@ -367,9 +367,22 @@
var current_page_index;
var page_node_local_index = hmi_local_index("page_node");
+function toggleFullscreen() {
+ let elem = document.documentElement;
+
+ if (!document.fullscreenElement) {
+ elem.requestFullscreen().catch(err => {
+ console.log("Error attempting to enable full-screen mode: "+err.message+" ("+err.name+")");
+ });
+ } else {
+ document.exitFullscreen();
+ }
+}
+
function prepare_svg() {
// prevents context menu from appearing on right click and long touch
document.body.addEventListener('contextmenu', e => {
+ toggleFullscreen();
e.preventDefault();
});