fix linter and do not require reload page if option was changed

This commit is contained in:
Andray 2024-03-16 16:14:57 +04:00
parent 79514e5b8e
commit 9142ce8188

View File

@ -839,30 +839,31 @@ onUiLoaded(async() => {
document.addEventListener("keydown", handleMoveKeyDown);
document.addEventListener("keyup", handleMoveKeyUp);
// Prevent firefox to open toolbar on pressing alt
if (hotkeysConfig.canvas_hotkey_zoom === "Alt") {
let isAltPressed = false;
let isAltPressed = false;
function handleAltKeyDown(e) {
if (!activeElement) return;
if (e.code === "AltLeft" || e.code === "AltRight") {
isAltPressed = true;
} else {
isAltPressed = false;
}
}
function handleAltKeyUp(e) {
if (isAltPressed) {
e.preventDefault();
}
function handleAltKeyDown(e) {
if (!activeElement) return;
if (hotkeysConfig.canvas_hotkey_zoom !== "Alt") return;
if (e.code === "AltLeft" || e.code === "AltRight") {
isAltPressed = true;
} else {
isAltPressed = false;
}
document.addEventListener("keydown", handleAltKeyDown);
document.addEventListener("keyup", handleAltKeyUp);
}
function handleAltKeyUp(e) {
if (hotkeysConfig.canvas_hotkey_zoom !== "Alt") return;
if (isAltPressed) {
e.preventDefault();
}
isAltPressed = false;
}
document.addEventListener("keydown", handleAltKeyDown);
document.addEventListener("keyup", handleAltKeyUp);
// Detect zoom level and update the pan speed.
function updatePanPosition(movementX, movementY) {