tablet style

This commit is contained in:
Devaev Maxim 2018-08-19 04:09:20 +03:00
parent 1591b8ed35
commit b687574920
5 changed files with 91 additions and 8 deletions

View File

@ -42,15 +42,15 @@ div#keyboard div.key:hover, div.modifier:hover {
color: var(--fg-color-intensive); color: var(--fg-color-intensive);
background-color: var(--bg-color-ctl); background-color: var(--bg-color-ctl);
} }
div#keyboard div.pressed, div.pressed { div#keyboard div.pressed {
box-shadow: none; box-shadow: none;
color: var(--fg-color-selected); color: var(--fg-color-selected) !important;
background-color: var(--bg-color-dark); background-color: var(--bg-color-dark) !important;
} }
div#keyboard div.holded { div#keyboard div.holded {
box-shadow: none; box-shadow: none;
color: var(--fg-color-normal); color: var(--fg-color-normal) !important;
background-color: var(--bg-color-intensive); background-color: var(--bg-color-intensive) !important;
} }
div#keyboard div.key:last-child, div.empty-key:last-child, div.modifier:last-child { div#keyboard div.key:last-child, div.empty-key:last-child, div.modifier:last-child {
margin-right: 0; margin-right: 0;

View File

@ -7,6 +7,7 @@ body {
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
user-select: none; user-select: none;
touch-action: manipulation;
} }
img#logo { img#logo {
-webkit-filter: invert(0.7); -webkit-filter: invert(0.7);

65
kvmd/web/css/mobile.css Normal file
View File

@ -0,0 +1,65 @@
/*
http://stephen.io/mediaqueries/
https://gist.github.com/gokulkrishh/242e68d1ee94ad05f488
*/
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) {
div.window {
padding-top: 45px !important;
}
div.window-header {
height: 35px !important;
}
div.window-grab {
height: 35px !important;
}
button.window-button-close {
height: 40px !important;
}
div#keyboard div.key:hover, div.modifier:hover {
color: var(--fg-color-normal);
background-color: var(--bg-color-gray);
}
}
@media only screen and (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
div.ctl-dropdown-content button {
height: 45px !important;
}
div#stream-window {
padding-top: 9px !important;
border-top: 0 !important;
border-radius: 0 0 8px 8px !important;
top: 50px !important;
left: 50% !important;
-webkit-transform: translateX(-50%) !important;
transform: translateX(-50%) !important;
}
div#stream-window-header {
display: none !important;
}
div#keyboard {
zoom: 1.1 !important;
}
div#keyboard-window {
visibility: visible !important;
padding-top: 9px !important;
padding-bottom: 30px !important;
border-bottom: 0 !important;
border-left: 0 !important;
border-right: 0 !important;
border-radius: 0 !important;
top: unset !important;
bottom: 0 !important;
width: 100% !important;
left: 50% !important;
-webkit-transform: translateX(-50%) !important;
transform: translateX(-50%) !important;
}
div#keyboard-window-header {
display: none !important
}
}

View File

@ -18,6 +18,8 @@
<link rel="stylesheet" href="css/keyboard.css"> <link rel="stylesheet" href="css/keyboard.css">
<link rel="stylesheet" href="css/about.css"> <link rel="stylesheet" href="css/about.css">
<link rel="stylesheet" href="css/mobile.css">
<script src="js/tools.js"></script> <script src="js/tools.js"></script>
<script src="js/stream.js"></script> <script src="js/stream.js"></script>
<script src="js/atx.js"></script> <script src="js/atx.js"></script>
@ -216,18 +218,18 @@
</ul> </ul>
<div id="stream-window" class="window" style="z-index: 1" tabindex="0"> <div id="stream-window" class="window" style="z-index: 1" tabindex="0">
<div class="window-header"><div class="window-grab">Stream</div></div> <div id="stream-window-header" class="window-header"><div class="window-grab">Stream</div></div>
<div id="stream-box" class="stream-box-inactive"> <div id="stream-box" class="stream-box-inactive">
<img id="stream-image" class="stream-image-inactive" src="png/blank-stream.png" /> <img id="stream-image" class="stream-image-inactive" src="png/blank-stream.png" />
</div> </div>
</div> </div>
<div id="keyboard-window" class="window" tabindex="0"> <div id="keyboard-window" class="window" tabindex="0">
<div class="window-header"> <div id="keyboard-window-header" class="window-header">
<div class="window-grab">Virtual Keyboard</div> <div class="window-grab">Virtual Keyboard</div>
<button class="window-button-close">&times;</button> <button class="window-button-close">&times;</button>
</div> </div>
<div id="keyboard"> <div id="keyboard" align="center">
<div class="keyboard-block"> <div class="keyboard-block">
<div class="keyboard-row"> <div class="keyboard-row">
<div id="Escape" class="key small"><p>Esc</p></div> <div id="Escape" class="key small"><p>Esc</p></div>

View File

@ -58,6 +58,9 @@ function Ui(hid) {
window.onmouseup = __globalMouseButtonHandler; window.onmouseup = __globalMouseButtonHandler;
// window.oncontextmenu = __globalMouseButtonHandler; // window.oncontextmenu = __globalMouseButtonHandler;
window.addEventListener("resize", () => __organizeWindowsOnResize(false));
window.addEventListener("orientationchange", () => __organizeWindowsOnResize(true));
$("show-about-button").onclick = () => self.showWindow($("about-window")); $("show-about-button").onclick = () => self.showWindow($("about-window"));
$("show-keyboard-button").onclick = () => self.showWindow($("keyboard-window")); $("show-keyboard-button").onclick = () => self.showWindow($("keyboard-window"));
$("show-stream-button").onclick = () => self.showWindow($("stream-window")); $("show-stream-button").onclick = () => self.showWindow($("stream-window"));
@ -153,6 +156,18 @@ function Ui(hid) {
} }
}; };
var __organizeWindowsOnResize = function(orientation) {
var view = __getViewGeometry();
Array.prototype.forEach.call($$("window"), function(el_window) {
if (el_window.style.visibility === "visible" && (orientation || el_window.hasAttribute("data-centered"))) {
var rect = el_window.getBoundingClientRect();
el_window.style.top = Math.max($("ctl").clientHeight, Math.round((view.bottom - rect.height) / 2)) + "px";
el_window.style.left = Math.round((view.right - rect.width) / 2) + "px";
el_window.setAttribute("data-centered", "");
}
});
};
var __makeWindowMovable = function(el_window) { var __makeWindowMovable = function(el_window) {
var el_header = el_window.querySelector(".window-header"); var el_header = el_window.querySelector(".window-header");
var el_grab = el_window.querySelector(".window-header .window-grab"); var el_grab = el_window.querySelector(".window-header .window-grab");