Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc css changes/fixes for cimbar.js #57

Merged
merged 4 commits into from
Jun 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@
padding: 0;
}

html, body {
height: 100vh;
}

body {
background-color: white;
background-image: radial-gradient(circle at top left, rgb(7,0,0),rgb(244,244,244),rgb(255,255,255));
background-size: cover;
color: gray;
height: 100vh;
display: grid;
align-items: center;
transition: opacity 0.4s ease-in;
Expand Down Expand Up @@ -115,8 +119,10 @@
cursor: pointer;
pointer-events: auto;
touch-action: manipulation;
border: 0;
outline: 0;
background-image: linear-gradient(180deg, rgb(0,0,0,0) 10%, rgb(0,0,0) 40%, rgb(0,0,0) 60%, rgb(0,0,0,0) 90%);
background-color: initial;
}
.icon-bar {
display: block;
Expand Down Expand Up @@ -262,12 +268,12 @@

<div id="nav-container" class="c4">
<div class="bg"></div>
<div id="nav-button" tabindex="0">
<button id="nav-button" tabindex="0">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</div>
</button>
<div id="nav-content" tabindex="-1">
<span id="current-file">No file selected</span>
<ul>
Expand All @@ -284,17 +290,12 @@
<a id="invisible_click" href="javascript:;" onclick="Main.clickNav()"></a>

<script type="text/javascript">
// reset zoom
document.body.style.zoom = (window.innerWidth / window.outerWidth);

var canvas = document.getElementById('canvas');
var width = window.outerWidth;
var height = window.outerHeight;

var Module = {};
Module.canvas = canvas;
Module.onRuntimeInitialized = () => {
Main.run(canvas, width, height);
Main.init();
Main.nextFrame();
};
</script>
Expand Down
21 changes: 15 additions & 6 deletions web/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ var _renderTime = 0;
function toggleFullscreen()
{
if (document.fullscreenElement) {
document.exitFullscreen();
return document.exitFullscreen();
}
else {
document.documentElement.requestFullscreen();
return document.documentElement.requestFullscreen();
}
}

Expand All @@ -39,18 +39,26 @@ function importFile(f)

// public interface
return {
run : function(canvas, width, height)
init : function(canvas)
{
console.log("init for canvas " + canvas);

Module._initialize_GL(1040, 1040);
Main.resize();
},

resize : function()
{
// reset zoom
var canvas = document.getElementById('canvas');
canvas.style.zoom = (window.innerWidth / window.outerWidth);
var width = window.outerWidth;
var height = window.outerHeight;
Main.scaleCanvas(canvas, width, height);
Main.alignInvisibleClick(canvas);
},

toggleFullscreen : function()
{
toggleFullscreen();
toggleFullscreen().then(Main.resize);
},

scaleCanvas : function(canvas, width, height)
Expand All @@ -75,6 +83,7 @@ return {
invisible_click.style.height = canvas.style.height;
invisible_click.style.top = cpos.top + "px";
invisible_click.style.left = cpos.left + "px";
invisible_click.style.zoom = canvas.style.zoom;
},

encode : function(filename, data)
Expand Down