excalidraw/excalidraw

Refactor point types ` { x, y }` to the proper unified point type in `@excalidraw/math`

Open

#9,297 opened on 2025年3月24日

GitHub で見る
 (12 comments) (0 reactions) (0 assignees)TypeScript (13,649 forks)batch import
good first issue

Repository metrics

Stars
 (123,243 stars)
PR merge metrics
 (平均マージ 5d 7h) (30d で 18 merged PRs)

説明

Goal: Have a unified point type system across the codebase.

  • Create missing point type ViewportPoint = [x, y] in @excalidraw/math
  • Create unified point type GenericPoint in @excalidraw/math
  • Refactor point generic function type parameters to extend GenericPoint where applicable
  • Refactor object point types (i.e. { x: number, y: number } to use GlobalPoint, LocalPoint, ViewportPoint or a combination as applicable

Note: Watch out for rough-js point types, which are also [x,y] but cannot be refactored. Avoid type casting as much as possible.

コントリビューターガイド