Skip to content

[feat/MAT-360] 입력 어댑터 패턴 + 지우개 bounds 최적화#302

Open
b0nsu wants to merge 1 commit intorefactor/mat-358-undo-redofrom
refactor/mat-360-input-eraser
Open

[feat/MAT-360] 입력 어댑터 패턴 + 지우개 bounds 최적화#302
b0nsu wants to merge 1 commit intorefactor/mat-358-undo-redofrom
refactor/mat-360-input-eraser

Conversation

@b0nsu
Copy link
Copy Markdown
Collaborator

@b0nsu b0nsu commented Apr 30, 2026

Summary

터치 입력을 추상화하는 어댑터 패턴을 도입하고, 지우개 히트 테스트에 StrokeBounds를 적용하여 ~20배 성능 개선합니다.
시나리오: 200 strokes에서 지우개 → bounds로 ~190 스킵 → point-level 비교 대폭 감소.

Stacked PR 5/10 — base: refactor/mat-359-textbox

Linear

Changes

  • input/inputTypes.ts — InputPhase, CancelReason, DrawingInputCallbacks
  • input/inputAdapterTypes.ts — InputAdapterConfig, InputAdapterState, InputAdapter
  • input/rnghPanAdapter.ts — RNGH Pan 제스처 어댑터
  • model/drawingTypes.ts — PointerType, InputEvent 타입 추가
  • DrawingCanvas에서 지우개 로직 StrokeBounds 기반으로 최적화

Testing

  • pnpm typecheck 통과
  • pnpm lint 통과

Risk / Impact

  • 영향 범위: 입력 처리 + 지우개 히트 판정 로직
  • 확인이 필요한 부분: 지우개 동작 동일성, 어댑터 패턴 통한 입력 처리
  • 배포 시 유의사항: 없음

@linear
Copy link
Copy Markdown

linear Bot commented Apr 30, 2026

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pointer-admin Ready Ready Preview, Comment May 8, 2026 3:12pm

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

터치/펜 입력을 추상화하기 위해 “입력 어댑터 패턴”을 도입하고, 지우개 히트 테스트를 StrokeBounds 기반으로 최적화해 point-level 비교를 크게 줄이려는 PR입니다.

Changes:

  • 입력 추상화를 위한 InputEvent, InputPhase/CancelReason, InputAdapter* 타입 및 RNGH Pan 기반 어댑터 훅 추가
  • DrawingCanvas에서 기존 Pan 제스처 로직을 어댑터로 치환
  • 지우개 삭제 판정에 StrokeBounds를 활용해 불필요한 stroke point 스캔을 스킵

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/pointer-native-drawing/src/model/drawingTypes.ts 입력 이벤트/포인터 타입을 모델 레벨 타입으로 추가
packages/pointer-native-drawing/src/input/inputTypes.ts 입력 단계/취소 사유/콜백 인터페이스 정의
packages/pointer-native-drawing/src/input/inputAdapterTypes.ts 어댑터 config/state/반환 타입 정의
packages/pointer-native-drawing/src/input/rnghPanAdapter.ts RNGH Pan 제스처를 DrawingInputCallbacks로 브릿지하는 어댑터 훅 추가
packages/pointer-native-drawing/src/DrawingCanvas.tsx Pan 입력 처리 어댑터로 교체 + 지우개 bounds 기반 최적화 및 bounds ref 동기화
packages/pointer-native-drawing/src/index.ts 신규 타입/훅 export 정리

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +10 to +14
const RNGH_POINTER_TYPE_MAP: Record<number, PointerType> = {
0: 'touch',
1: 'pen',
2: 'mouse',
};
Comment on lines +39 to +45
const phaseShared = useSharedValue<InputPhase>('idle');
const phaseRef = useRef<InputPhase>('idle');

const eraserModeShared = useSharedValue(eraserMode);
eraserModeShared.value = eraserMode;
const pencilOnlyShared = useSharedValue(pencilOnly);
pencilOnlyShared.value = pencilOnly;
(phaseShared.value === 'began' || phaseShared.value === 'active')
) {
phaseShared.value = 'cancelled';
runOnJS(handleDrawCancel)('gesture_failed' as CancelReason);
@b0nsu b0nsu changed the base branch from refactor/mat-359-textbox to refactor/mat-358-undo-redo May 8, 2026 15:04
- input/inputTypes.ts: CancelReason, DrawingInputCallbacks
- input/inputAdapterTypes.ts: InputAdapterConfig, InputAdapter (state.phase 미노출 — consumer 0건)
- input/rnghPanAdapter.ts: pan gesture 어댑터
  - PointerType enum 매핑 (RnghPointerType.TOUCH/STYLUS/MOUSE)
  - 'gesture_failed' literal (불필요한 as CancelReason 제거)
- model/drawingTypes.ts: PointerType, InputEvent 추가
- DrawingCanvas.tsx:
  - pan inline → useRnghPanAdapter + DrawingInputCallbacks
  - eraseAtPoint AABB 사전 검사 — bounds + eraserSize 영역 밖 strokes 점 검사 skip

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@b0nsu b0nsu force-pushed the refactor/mat-360-input-eraser branch from 6ecb49f to 51d4099 Compare May 8, 2026 15:12
b0nsu added a commit that referenced this pull request May 8, 2026
…nvas iOS 통합

- ios/PencilGestureRecognizer.{h,m}: UIGestureRecognizer 서브클래스 (Apple Pencil precise + 240Hz coalesced + predicted touches)
- ios/StylusInputView.{h,mm}: Fabric component — UITouch 좌표/force/altitude/azimuth 패킹
- src/specs/StylusInputViewNativeComponent.ts: codegen spec
- src/input/nativeStylusAdapter.tsx: native overlay 어댑터
  - state.phase 외부 미노출 (consumer 0건 — PR #302 인터페이스와 일관)
  - acceptFingerInput 미전달 (textbox 비활성화 정책 — native default false)
- pointer-native-drawing.podspec + package.json: codegen 등록
- DrawingCanvas.tsx: Platform 분기
  - iOS = native overlay (240Hz pencil 풀 활용), rngh pan 비활성
  - Android/Web = rngh pan 그대로

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants