Merge remote-tracking branch 'origin/sub_laptop_4' into main_laptop_1

This commit is contained in:
2026-10-10 15:43:09 +09:00
2 changed files with 22 additions and 12 deletions
+16 -8
View File
@@ -4,14 +4,22 @@ const fs = require("fs");
const path = require("path");
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
const file = path.join(__dirname, "..", "..", "ui_template", "ui_template_loupe.ts");
const js = ts.transpileModule(fs.readFileSync(file, "utf8"), {
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
}).outputText;
const box = { exports: {} };
const req = (p) => (p.endsWith(".css") ? {} : require(p));
new Function("exports", "module", "require", js)(box.exports, box, req);
const m = box.exports;
const ROOT = path.join(__dirname, "..", "..");
function load(file) {
const js = ts.transpileModule(fs.readFileSync(file, "utf8"), {
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
}).outputText;
const box = { exports: {} };
const req = (p) =>
p.endsWith(".css")
? {}
: p.endsWith("key_shortcut") // 공용 키 판정(214-2)도 그 자리에서 트랜스파일
? load(path.join(ROOT, "A00_Common", "key_shortcut.ts"))
: require(p);
new Function("exports", "module", "require", js)(box.exports, box, req);
return box.exports;
}
const m = load(path.join(ROOT, "ui_template", "ui_template_loupe.ts"));
// ---- 가짜 시계 · 가짜 창 ----
function fakeWindow(doc) {
+6 -4
View File
@@ -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();
});