[pull] main from tldraw:main#586
Merged
Merged
Conversation
#9139) In order to fix the redo shortcut regressing on macOS, this PR changes the held-key fallback guard added in #9099 so it only applies to auto-repeat keydowns. #9099 tracked which registration each physically-held key (keyed by `event.code`) first triggered, and cleared that tracking on `keyup`. But macOS swallows the `keyup` for non-modifier keys while `cmd` is held. So after `cmd+z` (undo), the stale undo registration for `KeyZ` was never cleared, and the next `cmd+shift+z` (redo) — which lands on the same physical `KeyZ` — was suppressed as an "adjacent shortcut" and never fired. Redo silently did nothing. The fix only guards auto-repeat (`event.repeat`) keydowns, which is the actual case #9099 targeted (holding `q` and releasing shift produces auto-repeat `q` events). A fresh keypress is always free to trigger whatever it matches, even on the same physical key, so `cmd+z` then `cmd+shift+z` works regardless of whether the intervening `keyup` was delivered. Holding `shift+q` and releasing shift still does not fall back to plain `q`. ### Change type - [x] `bugfix` ### Test plan 1. On macOS, draw something and make a couple of edits. 2. Hold `cmd` and press `z` to undo. 3. Keeping `cmd` held, press `shift+z` to redo. 4. Confirm redo fires (it previously did nothing). - [x] Unit tests ### Release notes - Fix redo (`cmd+shift+z`) not firing after an undo (`cmd+z`) on macOS when cmd is kept held.
…pan (#9140) In order to stop fast right-click pans from zooming the camera to 800% on release, this PR passes a sanitized direction (`z: 0`) to `slideCamera` in the right-mouse-button pointer-up path. The raw pointer-velocity `Vec` was being passed directly, and `Vec.z` defaults to 1 because it doubles as pen pressure; since #7858, `slideCamera` interprets `direction.z` as a zoom direction, so the inertia fling multiplied the zoom every tick until it hit the max-zoom clamp. The left and middle button paths already sanitize the direction this way; this brings the right-click path in line. Closes #9138. The underlying hazard of `Vec.z` carrying different meanings across APIs is tracked separately in #9146. ### Change type - [x] `bugfix` ### Test plan 1. Open any tldraw canvas. 2. Right-click and drag quickly to pan, then release while still moving. 3. The camera glides to a stop at the same zoom level instead of jumping to 800%. 4. Slow right-click pans and left/middle button (spacebar) pans behave as before. - [x] Unit tests ### Release notes - Fixed a bug where releasing a fast right-click pan zoomed the camera to the maximum zoom level. ### Code changes | Section | LOC change | | --------- | ---------- | | Core code | +4 / -1 | | Tests | +11 / -0 |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )