feat(CAD): 332-3 설정 배선 — 휠 확대 방향 · 내 별칭
- 휠 — A00_Common/input_prefs 방향(기본 당김 = 지금과 같음 · 밀기 저장 뒤 뒤집힘) · 트랙패드 핀치는 늘 벌리면 확대(옛 CAD 는 벌리면 축소) - 별칭 — 명령 이름 > 내 별칭(cadAliases) > 기본 별칭 · 자동완성 후보 맨 앞 · 부를 때마다 읽어 저장 즉시 따름 - tsconfig include 에 input_prefs.ts · 시험 resources/tester/cad/input-prefs-cad.test.ts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013QyNXY2TUKXCFMwAca2APG
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
} from './commands.utility';
|
||||
import { ALIGN_COMMANDS, MODIFY_COMMANDS } from './commands.modify';
|
||||
import { VIEW_COMMANDS } from './commands.view';
|
||||
import { inputPrefs } from '../../../../A00_Common/input_prefs';
|
||||
|
||||
const ALL_COMMANDS: CadCommand[] = [
|
||||
...DRAW_COMMANDS,
|
||||
@@ -112,11 +113,24 @@ export const TOOL_STATE_MACHINES = Object.fromEntries(
|
||||
])
|
||||
) as Record<Tool, AnyToolMachine>;
|
||||
|
||||
/** 명령행 입력 해석 — 정확한 이름·별칭이 먼저, 없으면 접두사 후보의 첫 항목 */
|
||||
/** 내 별칭(☰ [설정] · `cadAliases`) 이 가리키는 명령들 — 부를 때마다 읽어 저장 즉시 따름 */
|
||||
function userAliasCommands(match: (alias: string) => boolean): CadCommand[] {
|
||||
return Object.entries(inputPrefs().cadAliases).flatMap(([id, aliases]) => {
|
||||
const command = COMMANDS_BY_ID.get(id);
|
||||
return command && aliases.some(match) ? [command] : [];
|
||||
});
|
||||
}
|
||||
|
||||
/** 명령행 입력 해석 — 이름 > 내 별칭 > 기본 별칭(acad.pgp 식), 없으면 접두사 후보의 첫 항목 */
|
||||
export function resolveCommandInput(input: string): CadCommand | undefined {
|
||||
const text = input.trim().toUpperCase();
|
||||
if (!text) return undefined;
|
||||
return COMMANDS_BY_ID.get(text) ?? COMMANDS_BY_ALIAS.get(text) ?? matchCommandPrefixes(text)[0];
|
||||
return (
|
||||
COMMANDS_BY_ID.get(text) ??
|
||||
userAliasCommands((alias) => alias === text)[0] ??
|
||||
COMMANDS_BY_ALIAS.get(text) ??
|
||||
matchCommandPrefixes(text)[0]
|
||||
);
|
||||
}
|
||||
|
||||
/** 접두사가 같은 명령 후보 (커서 옆 자동완성 목록에 쓴다) */
|
||||
@@ -127,7 +141,8 @@ export function matchCommandPrefixes(input: string): CadCommand[] {
|
||||
(command.aliases ?? []).some((alias) => alias.startsWith(text))
|
||||
);
|
||||
const byId = ALL_COMMANDS.filter((command) => command.id.startsWith(text));
|
||||
return [...new Set([...byAlias, ...byId])];
|
||||
const byUser = userAliasCommands((alias) => alias.startsWith(text));
|
||||
return [...new Set([...byUser, ...byAlias, ...byId])];
|
||||
}
|
||||
|
||||
/** 명령행 자동완성에 보여줄 문자열 (예: "LINE (L) 선") */
|
||||
|
||||
@@ -22,8 +22,8 @@ describe('CAD 휠 = 늘 줌(153-3)', () => {
|
||||
expect(wheel(-1, 2)).toEqual({ delta: WHEEL_PAGE_PX, exponent: WHEEL_ZOOM_EXPONENT });
|
||||
});
|
||||
|
||||
it('ctrl+휠(핀치)은 핀치 지수', () => {
|
||||
expect(wheel(-7, 0, true)).toEqual({ delta: 7, exponent: PINCH_ZOOM_EXPONENT });
|
||||
it('ctrl+휠(핀치)은 핀치 지수 · 벌리면(deltaY < 0) 확대(332)', () => {
|
||||
expect(wheel(-7, 0, true)).toEqual({ delta: -7, exponent: PINCH_ZOOM_EXPONENT });
|
||||
});
|
||||
|
||||
it('델타 0 은 안 움직임', () => {
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
WHEEL_PAGE_PX,
|
||||
WHEEL_ZOOM_EXPONENT,
|
||||
} from '../App.consts.ts';
|
||||
import { wheelEventIn } from '../../../../A00_Common/input_prefs';
|
||||
|
||||
/**
|
||||
* 휠 한 번 → 화면 확대(`zoomScreen` 인자). 휠은 늘 줌 · 커서 자리 고정(153-3) — 마우스 · 트랙패드를
|
||||
@@ -17,8 +18,12 @@ export function wheelZoom(
|
||||
const unitPx = evt.deltaMode === 1 ? WHEEL_LINE_PX : evt.deltaMode === 2 ? WHEEL_PAGE_PX : 1;
|
||||
const deltaY = evt.deltaY * unitPx;
|
||||
if (deltaY === 0) return null;
|
||||
// Aislo: wheel direction is inverted on purpose - pulling the wheel zooms in, pushing
|
||||
// zooms out, matching the B04/B05 maps and the B06 cross sections (2026-08-02).
|
||||
// 방향 = ☰ [설정] 휠 확대 방향(기본 당김 = 몸 쪽으로 굴리면 확대 · 모든 화면 일체) ·
|
||||
// 트랙패드 핀치는 늘 벌리면 확대. zoomScreen 은 음수 = 확대.
|
||||
// 핀치(ctrl+휠)는 델타가 잘아 지수만 크게.
|
||||
return { delta: -deltaY, exponent: evt.ctrlKey ? PINCH_ZOOM_EXPONENT : WHEEL_ZOOM_EXPONENT };
|
||||
const size = Math.abs(deltaY);
|
||||
return {
|
||||
delta: wheelEventIn({ ctrlKey: evt.ctrlKey, deltaY }) ? -size : size,
|
||||
exponent: evt.ctrlKey ? PINCH_ZOOM_EXPONENT : WHEEL_ZOOM_EXPONENT,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user