refactor(공용): 돋보기 Z 키 판정 — 공용 key_shortcut keyLetter 로 바꿈 · 동작 그대로(218-2)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QND7Co43B24zK2P937rdxt
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
* ========================================================================== */
|
||||
|
||||
import "./ui_template_loupe.css";
|
||||
import { keyLetter } from "../A00_Common/key_shortcut";
|
||||
|
||||
/** 원 지름(px) */
|
||||
export const LOUPE_DIAMETER = 240;
|
||||
@@ -51,11 +52,12 @@ const KEEP_INSIDE = new Set([
|
||||
"CAPTION",
|
||||
]);
|
||||
|
||||
/** Z 키 판정 — 글자(`key`)가 아니라 자판 자리(`code`) · 한글 자판(「ㅋ」)도 같음(CAD `input-shortcut` 과 같은 원리) · Ctrl/Alt/Meta 조합은 아님 */
|
||||
/** Z 키 판정 — 공용 `keyLetter`(214-2 · 한글 자판 「ㅋ」 = 자판 자리 KeyZ) · Ctrl/Alt/Meta 조합은 아님 */
|
||||
export function isLoupeKey(
|
||||
evt: Pick<KeyboardEvent, "code" | "ctrlKey" | "altKey" | "metaKey">,
|
||||
evt: Pick<KeyboardEvent, "code" | "ctrlKey" | "altKey" | "metaKey"> &
|
||||
Partial<Pick<KeyboardEvent, "key">>,
|
||||
): boolean {
|
||||
return evt.code === "KeyZ" && !evt.ctrlKey && !evt.altKey && !evt.metaKey;
|
||||
return keyLetter(evt) === "z" && !evt.ctrlKey && !evt.altKey && !evt.metaKey;
|
||||
}
|
||||
|
||||
/** 글을 치는 자리 — 글 칸 · 고르기 칸 · contenteditable */
|
||||
@@ -159,7 +161,7 @@ export function initLoupe(
|
||||
update();
|
||||
});
|
||||
on("keyup", (e) => {
|
||||
if (e.code !== "KeyZ" || !key) return;
|
||||
if (keyLetter(e) !== "z" || !key) return;
|
||||
key = false;
|
||||
update();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user