Skip to content

Commit 4eb774d

Browse files
committed
option key crosshair
1 parent 5c10112 commit 4eb774d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/pages/Content/index.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ bboxAnchor.style.left = '0px';
77
bboxAnchor.style.width = `0px`;
88
bboxAnchor.style.height = `0px`;
99

10-
let mouseIsDown = false;
10+
let hotKeyIsDown = false,
11+
mouseIsDown = false;
1112
let startingX: number | undefined = undefined,
1213
startingY: number | undefined = undefined;
1314

@@ -98,5 +99,17 @@ window.addEventListener('keydown', (event) => {
9899
startingY = undefined;
99100
document.body.classList.remove('no-select');
100101
resetBBoxAnchor();
102+
} else if (event.altKey) {
103+
hotKeyIsDown = true;
104+
document.body.classList.add('no-select');
105+
}
106+
});
107+
108+
window.addEventListener('keyup', (event) => {
109+
if (hotKeyIsDown && !event.altKey) {
110+
hotKeyIsDown = false;
111+
if (!mouseIsDown) {
112+
document.body.classList.remove('no-select');
113+
}
101114
}
102115
});

0 commit comments

Comments
 (0)