Skip to content

Commit 5ed2d70

Browse files
committed
prevent alt menu for firefox
1 parent 3e0146f commit 5ed2d70

File tree

1 file changed

+23
-0
lines changed
  • extensions-builtin/canvas-zoom-and-pan/javascript

1 file changed

+23
-0
lines changed

extensions-builtin/canvas-zoom-and-pan/javascript/zoom.js

+23
Original file line numberDiff line numberDiff line change
@@ -966,3 +966,26 @@ onUiLoaded(async() => {
966966
// Add integration with Inpaint Anything
967967
// applyZoomAndPanIntegration("None", ["#ia_sam_image", "#ia_sel_mask"]);
968968
});
969+
970+
971+
onUiLoaded(function(){
972+
let isAltPressed = false;
973+
974+
function handleAltKeyDown(e) {
975+
if (e.code === "AltLeft" || e.code === "AltRight") {
976+
isAltPressed = true;
977+
} else {
978+
isAltPressed = false;
979+
}
980+
}
981+
982+
function handleAltKeyUp(e) {
983+
if (isAltPressed) {
984+
e.preventDefault();
985+
}
986+
isAltPressed = false;
987+
}
988+
989+
document.addEventListener("keydown", handleAltKeyDown);
990+
document.addEventListener("keyup", handleAltKeyUp);
991+
});

0 commit comments

Comments
 (0)