Skip to content

Commit

Permalink
Fullscreen toggle?
Browse files Browse the repository at this point in the history
  • Loading branch information
sz3 committed Mar 4, 2021
1 parent 48b2d1a commit 7247339
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@
<span id="current-file">No file selected</span>
<ul>
<li><a class="attention" id="nav-find-file-link" href="javascript:void(0)" onclick="Main.clickFileInput()">Find File</a></li>
<li><a href="javascript:void(0)" onclick="Main.toggleFullscreen()">Fullscreen</a></li>
<hr>
<li><a class="c4" href="javascript:void(0)" onclick="Main.setColorBits(2)">4-color</a></li>
<li><a class="c8" href="javascript:void(0)" onclick="Main.setColorBits(3)">8-color</a></li>
Expand Down
16 changes: 16 additions & 0 deletions web/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ var _showStats = false;
var _renders = 0;
var _renderTime = 0;

function toggleFullscreen()
{
var elem = document.body;
if (document.fullscreenElement) {
document.exitFullscreen();
}
else {
elem.requestFullscreen();
}
}

function importFile(f)
{
const fileReader = new FileReader();
Expand Down Expand Up @@ -38,6 +49,11 @@ return {
Main.alignInvisibleClick(canvas);
},

toggleFullscreen : function()
{
toggleFullscreen();
},

scaleCanvas : function(canvas, width, height)
{
var dim = width;
Expand Down

0 comments on commit 7247339

Please sign in to comment.