Skip to content

fix(editor): support touch input and fix coordinate mapping on small … - #3

Merged
OliEder merged 1 commit into
mainfrom
claude/app-review-Oy0Ta
May 30, 2026
Merged

OliEder merged 1 commit into
mainfrom
claude/app-review-Oy0Ta

Conversation

@OliEder

@OliEder OliEder commented May 30, 2026

Copy link
Copy Markdown
Contributor

…screens

The editor was mouse-only, so on phones/tablets entities could be added (palette taps) but never dragged or otherwise manipulated.

  • Replace mouse handlers with pointer events (mouse + touch + pen) and use pointer capture so a drag keeps tracking when the token moves under the finger/cursor or the SVG re-renders.
  • Map client coordinates through the SVG screen CTM instead of assuming client pixels equal viewBox units. The court scales to 100% width, so the old 1:1 assumption was wrong whenever it was not rendered at exactly its viewBox width (always the case on mobile), which mis-placed hits and drags.
  • Swallow the click synthesized after a moving drag so it cannot deselect.

Tests: add a touch-drag regression (narrow viewport + touch, exercises both the pointer path and CTM mapping) and port the canvas-coordinate tests to the screen CTM. Both new touch/snap tests fail on the pre-fix mouse-only code. Full suite: 28 passed.

…screens

The editor was mouse-only, so on phones/tablets entities could be added
(palette taps) but never dragged or otherwise manipulated.

- Replace mouse handlers with pointer events (mouse + touch + pen) and use
  pointer capture so a drag keeps tracking when the token moves under the
  finger/cursor or the SVG re-renders.
- Map client coordinates through the SVG screen CTM instead of assuming
  client pixels equal viewBox units. The court scales to 100% width, so the
  old 1:1 assumption was wrong whenever it was not rendered at exactly its
  viewBox width (always the case on mobile), which mis-placed hits and drags.
- Swallow the click synthesized after a moving drag so it cannot deselect.

Tests: add a touch-drag regression (narrow viewport + touch, exercises both
the pointer path and CTM mapping) and port the canvas-coordinate tests to the
screen CTM. Both new touch/snap tests fail on the pre-fix mouse-only code.
Full suite: 28 passed.
@OliEder
OliEder merged commit cb9a67c into main May 30, 2026
3 checks passed
@OliEder
OliEder deleted the claude/app-review-Oy0Ta branch May 30, 2026 05:32
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