Batch held arrow-key transforms into a single undo entry and autosave - #100
Open
davidsteinmeyer wants to merge 1 commit into
Open
Batch held arrow-key transforms into a single undo entry and autosave#100davidsteinmeyer wants to merge 1 commit into
davidsteinmeyer wants to merge 1 commit into
Conversation
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.
Summary
Keyboard movement committed a history snapshot and synced the project on every keydown repeat, so holding an arrow key produced one undo entry and one autosave per repeat. This reuses the existing pointer-drag interaction model so a continuous hold is one undo step and one autosave, while discrete taps still record individually. Geometry, selection, and durability are unchanged.
Root cause
nudgeSelectedandraiseSelectedcalledcommitShapeson every keydown, which appended a history snapshot and calledsyncProjectShapes.projectInteractionActive/finalizeInteractionHistory, but keyboard movement bypassed that path.Changes
heldMoveKeysRefandkeyboardInteractionOwnedRefto track the keys in a hold.applyLiveShapes, the interaction-time counterpart ofcommitShapes: it updates shapes and marks the interaction as changed without appending history or syncing.nudgeSelected/raiseSelectednow readshapesRef.currentand useapplyLiveShapeswhile an interaction is active, falling back tocommitShapesotherwise.updateProjectInteractionActive(true)), and keyup finalizes it when the last held movement key is released.blurandvisibilitychange(hidden) also finalize so a missed keyup cannot wedge the interaction.Testing
npm run typecheck