Skip to content

Commit

Permalink
Add fullscreen option to the settings menu.
Browse files Browse the repository at this point in the history
Useful for mobile devices, where you can't simply hit F11.
  • Loading branch information
lhartmann authored and qu1ck committed Apr 15, 2020
1 parent f346175 commit 22122f0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions InteractiveHtmlBom/web/ibom.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
<input id="darkmodeCheckbox" type="checkbox" onchange="setDarkMode(this.checked)">
Dark mode
</label>
<label class="menu-label">
<input id="fullscreenCheckbox" type="checkbox" onchange="setFullscreen(this.checked)">
Full Screen
</label>
<label class="menu-label">
<input id="padsCheckbox" type="checkbox" checked onchange="padsVisible(this.checked)">
Show footprint pads
Expand Down
14 changes: 14 additions & 0 deletions InteractiveHtmlBom/web/ibom.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ function setDarkMode(value) {
redrawIfInitDone();
}

function setFullscreen(value) {
if (value) {
document.documentElement.requestFullscreen();
} else {
document.exitFullscreen();
}
}

function fabricationVisible(value) {
writeStorage("fabricationVisible", value);
settings.renderFabrication = value;
Expand Down Expand Up @@ -936,6 +944,12 @@ window.onload = function(e) {
prepCheckboxes();
// Triggers render
changeBomLayout(settings.bomlayout);

// Users may leave fullscreen without touching the checkbox. Uncheck.
document.addEventListener('fullscreenchange', () => {
if (!document.fullscreenElement)
document.getElementById('fullscreenCheckbox').checked = false;
});
}

window.onresize = resizeAll;
Expand Down

0 comments on commit 22122f0

Please sign in to comment.