mirror of https://github.com/sz3/libcimbar
Merge pull request #57 from sz3/css-fix
Misc css changes/fixes for cimbar.js
This commit is contained in:
commit
ef6df875eb
|
@ -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;
|
||||
|
@ -115,8 +119,10 @@ body {
|
|||
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;
|
||||
|
@ -262,12 +268,12 @@ body {
|
|||
|
||||
<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>
|
||||
|
@ -284,17 +290,12 @@ body {
|
|||
<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>
|
||||
|
|
21
web/main.js
21
web/main.js
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue