Skip to content

Commit 22122f0

Browse files
lhartmannqu1ck
authored andcommitted
Add fullscreen option to the settings menu.
Useful for mobile devices, where you can't simply hit F11.
1 parent f346175 commit 22122f0

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

InteractiveHtmlBom/web/ibom.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@
5555
<input id="darkmodeCheckbox" type="checkbox" onchange="setDarkMode(this.checked)">
5656
Dark mode
5757
</label>
58+
<label class="menu-label">
59+
<input id="fullscreenCheckbox" type="checkbox" onchange="setFullscreen(this.checked)">
60+
Full Screen
61+
</label>
5862
<label class="menu-label">
5963
<input id="padsCheckbox" type="checkbox" checked onchange="padsVisible(this.checked)">
6064
Show footprint pads

InteractiveHtmlBom/web/ibom.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ function setDarkMode(value) {
7272
redrawIfInitDone();
7373
}
7474

75+
function setFullscreen(value) {
76+
if (value) {
77+
document.documentElement.requestFullscreen();
78+
} else {
79+
document.exitFullscreen();
80+
}
81+
}
82+
7583
function fabricationVisible(value) {
7684
writeStorage("fabricationVisible", value);
7785
settings.renderFabrication = value;
@@ -936,6 +944,12 @@ window.onload = function(e) {
936944
prepCheckboxes();
937945
// Triggers render
938946
changeBomLayout(settings.bomlayout);
947+
948+
// Users may leave fullscreen without touching the checkbox. Uncheck.
949+
document.addEventListener('fullscreenchange', () => {
950+
if (!document.fullscreenElement)
951+
document.getElementById('fullscreenCheckbox').checked = false;
952+
});
939953
}
940954

941955
window.onresize = resizeAll;

0 commit comments

Comments
 (0)