From b16053e9e4ec2bd1f381f06cdaf5faca4804054a Mon Sep 17 00:00:00 2001 From: umsangdon Date: Sat, 29 Aug 2026 16:54:23 +0900 Subject: [PATCH] =?UTF-8?q?fix(B07):=20=ED=8A=B8=EB=9E=99=ED=8C=A8?= =?UTF-8?q?=EB=93=9C=20=ED=95=80=EC=B9=98=EA=B0=80=20=EB=B8=8C=EB=9D=BC?= =?UTF-8?q?=EC=9A=B0=EC=A0=80=EA=B9=8C=EC=A7=80=20=ED=99=95=EB=8C=80?= =?UTF-8?q?=ED=95=98=EB=8D=98=20=EA=B2=83=EC=9D=84=20=EB=A7=89=EB=8A=94?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 핀치는 ctrl+wheel 이벤트인데 CAD 휠 처리가 preventDefault를 하지 않아 브라우저 기본 확대가 그대로 실행됐다. 캔버스 밖(리본·패널)에는 휠 핸들러조차 없었다. - 캔버스 휠 리스너를 passive:false로 등록하고 handleMouseWheel에서 preventDefault - document에 ctrl+wheel만 막는 리스너 — 리본·패널 위 핀치도 브라우저 확대 금지, ctrl 없는 휠은 남겨 패널 스크롤 유지 확대 감각(세기)·방향·로그는 건드리지 않았다 — 별도 제안으로 PLAN.md 보류 항목. Co-Authored-By: Claude Fable 5 --- .../src/inputController/input-controller.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/B07_DesignDetail/openwebcad/src/inputController/input-controller.ts b/B07_DesignDetail/openwebcad/src/inputController/input-controller.ts index 55c0592a..4dad90a8 100644 --- a/B07_DesignDetail/openwebcad/src/inputController/input-controller.ts +++ b/B07_DesignDetail/openwebcad/src/inputController/input-controller.ts @@ -67,13 +67,25 @@ export class InputController { canvas?.addEventListener('mousedown', (evt: MouseEvent) => this.handleMouseDown(evt)); canvas?.addEventListener('mousemove', (evt: MouseEvent) => this.handleMouseMove(evt)); canvas?.addEventListener('mouseup', (evt: MouseEvent) => this.handleMouseUp(evt)); - canvas?.addEventListener('wheel', (evt: WheelEvent) => this.handleMouseWheel(evt)); + // passive:false — 핀치·휠의 브라우저 기본 확대/스크롤을 막아야 한다. + canvas?.addEventListener('wheel', (evt: WheelEvent) => this.handleMouseWheel(evt), { + passive: false, + }); canvas?.addEventListener('mouseout', () => this.handleMouseOut()); canvas?.addEventListener('mouseenter', () => this.handleMouseEnter()); // Stop the context menu from appearing when right-clicking canvas?.addEventListener('contextmenu', (evt) => { evt.preventDefault(); }); + // 캔버스 밖(리본·패널) 위에서의 트랙패드 핀치도 브라우저를 확대시키지 않는다. + // ctrl이 없는 휠은 그대로 둬서 패널 스크롤은 살린다. + document.addEventListener( + 'wheel', + (evt: WheelEvent) => { + if (evt.ctrlKey) evt.preventDefault(); + }, + { passive: false } + ); } public draw(drawController: ScreenCanvasDrawController) { @@ -214,6 +226,8 @@ export class InputController { * @param evt */ public handleMouseWheel(evt: WheelEvent) { + // 확대는 도면만 — 트랙패드 핀치(ctrl+휠)가 브라우저 전체를 키우던 것을 막는다. + evt.preventDefault(); if (Math.abs(evt.deltaY) === 0) { return; // We can't zoom by zero delta }