- 고르기: 누름 = 더함 · 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
91 lines
3.9 KiB
Python
91 lines
3.9 KiB
Python
"""244-8 B08 거리이정표 다이어그램 영역 스크롤 없앰(사용자 135번).
|
|
|
|
틀 = overflow hidden · 그림 = 틀 안 맞춤(높이 48vh 넘으면 좁힘) · 휠 = 줌만.
|
|
휠은 공용 `A00_Common/b_svg_zoom_pan.ts` 와 다이어그램 틀 듣개를 node 로 돌려
|
|
진짜 wheel 사건(cancelable)을 보내 기본동작(스크롤)이 막히는지 · 배율이 바뀌는지 잼.
|
|
"""
|
|
|
|
import json
|
|
import re
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
IMPORTS = re.compile(r"^import[^;]*;\n", re.MULTILINE)
|
|
DIAGRAM = "B08_Quantity/B08_Quantity_UI_Milestone_Diagram.ts"
|
|
|
|
|
|
def _read(rel):
|
|
return (ROOT / rel).read_text(encoding="utf-8")
|
|
|
|
|
|
def _node(script):
|
|
# 휠 방향 읽기 층(332) 을 앞에 붙임 — Node 엔 저장소가 없어 기본(밀면 확대 · 337)
|
|
src = _read("A00_Common/input_prefs.ts") + IMPORTS.sub(
|
|
"", _read("A00_Common/b_svg_zoom_pan.ts")
|
|
)
|
|
result = subprocess.run(
|
|
["node", "--experimental-strip-types", "--no-warnings",
|
|
"--input-type=module-typescript", "-e", src + "\n" + script],
|
|
capture_output=True, text=True, encoding="utf-8", timeout=60,
|
|
) # fmt: skip
|
|
assert result.returncode == 0, result.stderr
|
|
return json.loads(result.stdout)
|
|
|
|
|
|
def test_틀_스크롤_없음_그림_맞춤():
|
|
css = _read("B08_Quantity/B08_Quantity_UI_Milestone.css")
|
|
block = css[css.index("\n.b08-milestone__diagram {") :]
|
|
block = block[: block.index("}")]
|
|
assert "overflow: hidden;" in block and "overflow: auto" not in block
|
|
assert "max-height" not in block # 높이는 그림이 맞춤 — 틀이 자르지 않음
|
|
ui = _read(DIAGRAM)
|
|
# 149 틀 = 폭 전체 · 높이 고정(CSS) · 그림 범위를 틀 비율로 넓힘(화면 px ↔ 그림 좌표 가로세로 같음)
|
|
assert "const scale = Math.max(lw / fw, lh / fh);" in ui
|
|
assert "height: clamp(420px, 58vh, 760px);" in _read(
|
|
"B08_Quantity/B08_Quantity_UI_Milestone.css"
|
|
)
|
|
|
|
|
|
def test_휠_진짜_사건_줌_스크롤_막음():
|
|
ui = _read(DIAGRAM)
|
|
line = next(ln.strip() for ln in ui.splitlines() if 'host.addEventListener("wheel"' in ln)
|
|
got = _node(
|
|
"""
|
|
const W = 600, H = 400;
|
|
class Svg extends EventTarget {
|
|
classList = { add() {}, remove() {} };
|
|
getBoundingClientRect() { return { left: 0, top: 0, width: W, height: H }; }
|
|
}
|
|
function wheel(target: EventTarget, deltaY: number) {
|
|
const ev = new Event("wheel", { cancelable: true, bubbles: true });
|
|
for (const [k, v] of Object.entries({ deltaY, clientX: 300, clientY: 200 }))
|
|
Object.defineProperty(ev, k, { value: v });
|
|
target.dispatchEvent(ev);
|
|
return ev.defaultPrevented;
|
|
}
|
|
const svg = new Svg();
|
|
const layer = { t: "", setAttribute(_k: string, v: string) { this.t = v; } };
|
|
attachSvgZoomPan({ svg: svg as any, layer: layer as any, widthPx: W, heightPx: H,
|
|
pad: { left: 0, right: 0, top: 0, bottom: 0 }, wheelZoom: true });
|
|
const svgIn = wheel(svg, -100);
|
|
const zoomIn = layer.t;
|
|
const svgOut = wheel(svg, 100);
|
|
const zoomOut = layer.t;
|
|
// 틀 듣개(그림 밖 여백 · 단추 줄) — 소스 줄 그대로 돌림 · passive 면 preventDefault 무시됨
|
|
const host = new EventTarget();
|
|
let opts: unknown = null;
|
|
const add = host.addEventListener.bind(host);
|
|
host.addEventListener = (t: string, f: any, o: any) => { opts = o; add(t, f, o); };
|
|
LINE
|
|
const hostBlocked = wheel(host, 100);
|
|
console.log(JSON.stringify({ svgIn, zoomIn, svgOut, zoomOut, hostBlocked, opts }));
|
|
""".replace("LINE", line)
|
|
)
|
|
# 그림 위 휠 = 줌(커서 자리 붙잡음) · 기본동작(스크롤) 막힘 = 스크롤 위치 안 바뀜
|
|
assert got["svgIn"] is True and got["zoomIn"].endswith(" scale(1.15)")
|
|
assert got["zoomIn"].startswith("translate(-45 -29.99") # 커서(300, 200) 제자리
|
|
assert got["svgOut"] is True and got["zoomOut"] != got["zoomIn"] # 당기면 축소
|
|
# 그림 밖 틀 위 휠도 페이지 스크롤로 안 샘
|
|
assert got["hostBlocked"] is True and got["opts"] == {"passive": False}
|