Skip to content

[refactor/MAT-900] DrawingCanvas wrapTextToLines 공통 헬퍼 + 텍스트 정책 cleanup#349

Draft
b0nsu wants to merge 3 commits into
developfrom
refactor/mat-900-wrap-text-dry
Draft

[refactor/MAT-900] DrawingCanvas wrapTextToLines 공통 헬퍼 + 텍스트 정책 cleanup#349
b0nsu wants to merge 3 commits into
developfrom
refactor/mat-900-wrap-text-dry

Conversation

@b0nsu
Copy link
Copy Markdown
Collaborator

@b0nsu b0nsu commented May 26, 2026

Summary

`wrapTextToLines` 공통 헬퍼 추출 + 옛 기획 텍스트 정책 제거.

Linear

Changes

  • `wrapTextToLines(text, maxWidth, measureText)` 순수 함수 추가 (paragraph + word 단위 줄바꿈)
  • `calculateTextLineCount` 가 `wrapTextToLines(...).length` 호출로 단순화
  • `renderedTexts` 가 같은 함수를 호출해 줄별 렌더
  • `isNearExistingText` 와 호출부 제거 (텍스트 주변 32px Y-band 필기 차단 삭제)
  • `addText` 자동 배치 로직 제거 (탭한 좌표에 그대로 새 텍스트 생성)

Testing

  • `pnpm typecheck && pnpm lint && pnpm build` 통과

Risk / Impact

  • props / imperative API 변경 없음
  • 동작 변화: 텍스트 위에서도 필기 가능, 새 텍스트는 자동으로 아래로 밀리지 않음
  • 독립 base (develop)

- wrapTextToLines: paragraph(\n) + word 단위 줄바꿈을 통합한 순수 함수
- calculateTextLineCount / renderedTexts 양쪽이 공유 → drift 방지
- isNearExistingText (32px Y-band 필기 차단) 제거 — 구 기획 정리
- addPoint / startStroke 의 차단 가드 + deps 정리
- addText 자동 배치 (필기/텍스트 아래 32px) 제거 — 탭한 좌표에 그대로 생성

props/imperative API 변경 없음. develop 독립 base (MAT-898 미의존).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@linear
Copy link
Copy Markdown

linear Bot commented May 26, 2026

MAT-900

b0nsu and others added 2 commits May 26, 2026 16:04
- wrapTextToLines 를 file-level export (단위 테스트 / 외부 활용 대비)
- textIdCounterRef 도입, ID 를 \`text-{Date.now()}-{counter}\` 형식으로 — 같은 ms 안 더블 탭으로 발생 가능한 React key 충돌 방지

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
실제 변경은 별도 PR. 향후 작업자에게 컨텍스트 남기는 주석만 추가.

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.

1 participant