Files
Aislo/resources/tester/helper_input_prefs.cjs
T
eomsangdonandClaude Opus 5.5 db8462c6d4 feat(B07 CAD): 337-2 마-1 오토캐드 마우스 — 누름 더함 · Shift 뺌 · 상자 더함/뺌 · 명령 중 끌기 상자 · 스침 · 그립 누르고-옮기고-누르기 · 그립 숫자 · 보기 전용 문 · 직교 강제 · Shift 임시 직교 · 휠 기본 밂 · 휠 두 번 범위
- 고르기: 누름 = 더함 · Shift = 뺌 · Ctrl = 넣고 빼기 · 상자 = 앞 고름 ∪ 상자 · Shift 상자 = 뺌(H4 · H5) · 명령 안 고르기 단계도 누를 때 첫 점 · 스침 강조(ic/selecting.ts)
- 그립: 쉴 때만 집음(N7) · 누르고 떼면 대기 → 다음 누름에 놓음 · 끌어 놓기(H3) · 거리 숫자(N8) · 확정 · 읽기 전용 도면은 그립 · Delete 막음(H2)
- 직교: F8 = 기준점에서 가로 · 세로 강제 · Shift 누른 동안 뒤집음 · 객체 스냅 점 · 좌표 · 각도 잠금은 안 덮음 · 클릭 사건 snapped 채움(ic/ortho.ts · H8) · 가이드는 F3 와 뗌 · 가이드 잡는 거리 = 화면 픽셀(H9)
- 휠: 기본 밂(앞으로 굴리면 확대 · 오토캐드 · 모든 화면 · ☰ 설정 뒤집기 그대로) · 가운데 단추 두 번 = 범위 줌 · ZOOM · ⛶ 앞 화면 기억(ic/zoom-prompt.ts)
- 시험: mouse-acad 새로 · 휠 방향 시험 손질(input-wheel · input-prefs-cad · input_prefs · app_settings · 164 · 220_1 · 221_1 · 244_8 기대값 뒤집음 · 266 pull 박음)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Se7ytqbohmBQnfYpwYFnYf
2026-10-15 23:41:46 +09:00

64 lines
2.7 KiB
JavaScript

/* PLAN 332-1 단위검증 헬퍼 — 휠 방향 읽기 층(`A00_Common/input_prefs.ts`) · 손가락 다리(`touch_bridge.ts`)
* · 등록표 키(`b_page_state.ts`)를 그 자리에서 트랜스파일해 Node 로 돌림. 가짜 localStorage 로 설정을 바꿔 봄.
* 결과 = 표준출력 JSON 한 벌. 짝 = `test_input_prefs.py`. */
const fs = require("fs");
const path = require("path");
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
const ROOT = path.join(__dirname, "..", "..");
const A00 = path.join(ROOT, "A00_Common");
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 === "./input_prefs" ? prefs : {});
new Function("exports", "module", "require", js)(box.exports, box, req);
return box.exports;
}
const out = {};
// ① Node(저장소 없음) — 불러올 때 window 를 안 만지고 기본값
const prefs = load(path.join(A00, "input_prefs.ts"));
const bridge = load(path.join(A00, "touch_bridge.ts"));
const page = load(path.join(A00, "b_page_state.ts"));
const sample = () => ({
prefs: prefs.inputPrefs(),
pull: prefs.wheelIn(100),
push: prefs.wheelIn(-100),
mouseCtrl: prefs.wheelEventIn({ ctrlKey: true, deltaY: 100 }),
padSpread: prefs.wheelEventIn({ ctrlKey: true, deltaY: -3.5 }),
padPinch: prefs.wheelEventIn({ ctrlKey: true, deltaY: 3.5 }),
fingerSpread: prefs.wheelEventIn({ ctrlKey: true, deltaY: -9.5 }, true),
bridgePull: bridge.wheelZoomsIn({ ctrlKey: false, deltaY: 100 }),
});
out.node = { key: prefs.INPUT_PREFS_KEY, default: prefs.DEFAULT_INPUT_PREFS, ...sample() };
out.registryKey = page.stateKey("input-prefs");
out.registryEntry = page.STATE_REGISTRY["input-prefs"];
// ② 브라우저 저장소 흉내 — 값을 바꾸면 다음 부름부터 바로 따름
const store = new Map();
globalThis.localStorage = {
getItem: (k) => (store.has(k) ? store.get(k) : null),
setItem: (k, v) => store.set(k, String(v)),
removeItem: (k) => store.delete(k),
};
const set = (v) => store.set(prefs.INPUT_PREFS_KEY, v);
set(JSON.stringify({ wheelZoom: "pull", cadAliases: { line: ["ll", 3], ARC: [] } }));
out.saved = sample(); // 기본 밂(337) 의 반대를 저장
set("{깨짐");
out.broken = sample();
set(JSON.stringify({ wheelZoom: "sideways" }));
out.unknown = sample();
store.delete(prefs.INPUT_PREFS_KEY);
out.empty = sample();
// ③ 불러오는 동안 저장소가 던지는 브라우저(사생활 보호) — 기본값
globalThis.localStorage = {
getItem: () => {
throw new Error("blocked");
},
};
out.blocked = sample();
process.stdout.write(JSON.stringify(out));