mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-12-15 07:20:31 +08:00
fix linter and do not require reload page if option was changed
This commit is contained in:
parent
79514e5b8e
commit
9142ce8188
@ -839,30 +839,31 @@ onUiLoaded(async() => {
|
|||||||
document.addEventListener("keydown", handleMoveKeyDown);
|
document.addEventListener("keydown", handleMoveKeyDown);
|
||||||
document.addEventListener("keyup", handleMoveKeyUp);
|
document.addEventListener("keyup", handleMoveKeyUp);
|
||||||
|
|
||||||
|
|
||||||
// Prevent firefox to open toolbar on pressing alt
|
// Prevent firefox to open toolbar on pressing alt
|
||||||
if (hotkeysConfig.canvas_hotkey_zoom === "Alt") {
|
let isAltPressed = false;
|
||||||
let isAltPressed = false;
|
|
||||||
|
|
||||||
function handleAltKeyDown(e) {
|
function handleAltKeyDown(e) {
|
||||||
if (!activeElement) return;
|
if (!activeElement) return;
|
||||||
if (e.code === "AltLeft" || e.code === "AltRight") {
|
if (hotkeysConfig.canvas_hotkey_zoom !== "Alt") return;
|
||||||
isAltPressed = true;
|
if (e.code === "AltLeft" || e.code === "AltRight") {
|
||||||
} else {
|
isAltPressed = true;
|
||||||
isAltPressed = false;
|
} else {
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleAltKeyUp(e) {
|
|
||||||
if (isAltPressed) {
|
|
||||||
e.preventDefault();
|
|
||||||
}
|
|
||||||
isAltPressed = false;
|
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.
|
// Detect zoom level and update the pan speed.
|
||||||
function updatePanPosition(movementX, movementY) {
|
function updatePanPosition(movementX, movementY) {
|
||||||
|
Loading…
Reference in New Issue
Block a user