summaryrefslogtreecommitdiff
path: root/kvmd/web/js
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2018-08-17 07:44:37 +0300
committerDevaev Maxim <[email protected]>2018-08-17 07:44:37 +0300
commit5b200160396a3b1d008cc7cc69d8815738615c52 (patch)
tree7df05e41f4aa5d5c9577faaf84c5db43f770e8a9 /kvmd/web/js
parenteaea72275ed62a64c17f1cc4dd96952fadc2165d (diff)
highlight grabbed window header
Diffstat (limited to 'kvmd/web/js')
-rw-r--r--kvmd/web/js/ui.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/kvmd/web/js/ui.js b/kvmd/web/js/ui.js
index 373c5a72..c369a675 100644
--- a/kvmd/web/js/ui.js
+++ b/kvmd/web/js/ui.js
@@ -155,6 +155,9 @@ function Ui(hid) {
};
var __makeWindowMovable = function(el_window) {
+ var el_header = el_window.querySelector(".window-header");
+ var el_grab = el_window.querySelector(".window-header .window-grab");
+
var prev_pos = {x: 0, y: 0};
function startMoving(event) {
@@ -164,6 +167,8 @@ function Ui(hid) {
event.preventDefault();
if (!event.touches || event.touches.length === 1) {
+ el_header.classList.add("window-header-grabbed");
+
prev_pos = getEventPosition(event);
document.onmousemove = doMoving;
@@ -192,6 +197,8 @@ function Ui(hid) {
}
function stopMoving() {
+ el_header.classList.remove("window-header-grabbed");
+
document.onmousemove = null;
document.onmouseup = null;
@@ -211,7 +218,6 @@ function Ui(hid) {
el_window.setAttribute("data-centered", "");
el_window.onclick = () => __raiseWindow(el_window);
- var el_grab = el_window.querySelector(".window-header .window-grab");
el_grab.onmousedown = startMoving;
el_grab.ontouchstart = startMoving;
};