aa2ff7d4bc
기존 문제: 점선 stroke / 연속 입력 누락 / 버튼 focus zoom / Safari 선택 팝업. 원인을 4축으로 분리해서 한꺼번에 fix. [1] 입력 수집 (PointerEvent 상태머신) - isDrawing flag + activePointerId 매칭으로 stroke 누락 방지 - pointerdown: 이전 inflight 가 살아있으면 finalize 후 새 stroke 시작 - setPointerCapture (try-catch) — element 외 pointer move 도 받음 - pointerup / pointercancel / pointerleave 통합 endStroke - pointerType === 'pen' (mouse 도 데스크톱) 만, 손가락 거부 [2] coalesced events - pointermove 의 e.getCoalescedEvents() 모두 points 에 push - 빠른 필기에서 sparse point → 점선 현상 방지 핵심 - normalizePressure: 0/비정상 값은 0.5 fallback [3] 렌더링: perfect-freehand polygon fill - getStroke(thinning:0.4, smoothing:0.62, streamline:0.5, last:true) - getSvgPathFromStroke (perfect-freehand README 표준 builder) → Path2D → ctx.fill() — anti-aliased polygon - 1점 케이스: arc fill 폴백 - last: true 항상 (진행 중에도 polygon 닫힘) [4] autosave 입력 분리 - 3초 idle debounce - flushSave 는 setTimeout 0 으로 다음 macrotask - PATCH 응답이 strokes 를 덮어쓰지 않음 (응답 무시, fire-and-forget) [5] Safari/Chrome hardening - 캔버스/컨테이너: touch-action: none + user-select: none + -webkit-touch-callout: none + -webkit-tap-highlight-color: transparent - canvas 에 oncontextmenu / onselectstart preventDefault - 모든 toolbar 버튼: clickThenBlur(fn) + tabindex=-1 + BTN_STYLE → button focus zoom 차단 (사용자 보고 "버튼 누르면 화면 확대" 핵심) [6] resize 정책 - ResizeObserver + window resize/orientationchange 만 트리거 - pointermove 마다 resize 절대 안 함 - DPR 반영 + setTransform(dpr,...) 으로 retina 선명 수정 범위 (사용자 명시): HandwriteCanvas.svelte 만. 다른 영역 무수정.