From a66779335db0e2d3f295ec0db68b9e9db9d276f3 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 23 May 2021 15:03:55 +0200 Subject: Add 'shift zoom' for blocks. --- public/common/client.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'public') diff --git a/public/common/client.js b/public/common/client.js index cee9ea5..26f953e 100644 --- a/public/common/client.js +++ b/public/common/client.js @@ -335,13 +335,26 @@ function zoom_map() { } } -window.addEventListener('resize', zoom_map); - function toggle_zoom() { document.querySelector(".mapwrap").classList.toggle('fit'); zoom_map(); } +function init_map_zoom() { + window.addEventListener('resize', zoom_map); +} + +function init_shift_zoom() { + window.addEventListener("keydown", (evt) => { + if (evt.key === "Shift") + document.querySelector("body").classList.add("shift"); + }); + window.addEventListener("keyup", (evt) => { + if (evt.key === "Shift") + document.querySelector("body").classList.remove("shift"); + }); +} + function toggle_log() { document.querySelector(".grid_window").classList.toggle("hide_log"); zoom_map(); -- cgit v1.2.3