Repository navigation
fix(editor): support touch input and fix coordinate mapping on small … - #3
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…screens
The editor was mouse-only, so on phones/tablets entities could be added (palette taps) but never dragged or otherwise manipulated.
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.