feat(CAD): 휠 = 늘 줌(커서 중심) · 휠 처리를 input-wheel.ts 로 떼기(153-3)
- 마우스 · 트랙패드 판정 지움 — 확대율 100 % 아닌 화면에서 휠이 팬으로 먹히던 것 - 트랙패드 두 손가락 팬 없어짐 · 팬 = 가운데 단추 끌기 - vitest input-wheel.test.ts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TNMXVCZXMpHpVvqmFkeChL
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import {
|
||||
PINCH_ZOOM_EXPONENT,
|
||||
WHEEL_LINE_PX,
|
||||
WHEEL_PAGE_PX,
|
||||
WHEEL_ZOOM_EXPONENT,
|
||||
} from '../App.consts.ts';
|
||||
|
||||
/**
|
||||
* 휠 한 번 → 화면 확대(`zoomScreen` 인자). 휠은 늘 줌 · 커서 자리 고정(153-3) — 마우스 · 트랙패드를
|
||||
* 가르지 않는다(옛 판정은 확대율 ≠ 100 % 등에서 휠을 팬으로 오판). 팬 = 가운데 단추 끌기.
|
||||
* null = 델타 0 이라 안 움직임.
|
||||
*/
|
||||
export function wheelZoom(
|
||||
evt: Pick<WheelEvent, 'deltaMode' | 'deltaY' | 'ctrlKey'>
|
||||
): { delta: number; exponent: number } | null {
|
||||
// deltaY 단위를 픽셀로 맞춘다 — 브라우저에 따라 줄(1)·쪽(2) 단위로 오기도 한다.
|
||||
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).
|
||||
// 핀치(ctrl+휠)는 델타가 잘아 지수만 크게.
|
||||
return { delta: -deltaY, exponent: evt.ctrlKey ? PINCH_ZOOM_EXPONENT : WHEEL_ZOOM_EXPONENT };
|
||||
}
|
||||
Reference in New Issue
Block a user