Skip to content

Batch held arrow-key transforms into a single undo entry and autosave - #100

Open
davidsteinmeyer wants to merge 1 commit into
Formsmith746:mainfrom
davidsteinmeyer:ds_hf_transform
Open

Batch held arrow-key transforms into a single undo entry and autosave#100
davidsteinmeyer wants to merge 1 commit into
Formsmith746:mainfrom
davidsteinmeyer:ds_hf_transform

Conversation

@davidsteinmeyer

Copy link
Copy Markdown

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

  • nudgeSelected and raiseSelected called commitShapes on every keydown, which appended a history snapshot and called syncProjectShapes.
  • Pointer drags already batch via projectInteractionActive / finalizeInteractionHistory, but keyboard movement bypassed that path.

Changes

  • Added heldMoveKeysRef and keyboardInteractionOwnedRef to track the keys in a hold.
  • Added applyLiveShapes, the interaction-time counterpart of commitShapes: it updates shapes and marks the interaction as changed without appending history or syncing.
  • nudgeSelected/raiseSelected now read shapesRef.current and use applyLiveShapes while an interaction is active, falling back to commitShapes otherwise.
  • Keydown starts an interaction on the first movement key (updateProjectInteractionActive(true)), and keyup finalizes it when the last held movement key is released. blur and visibilitychange (hidden) also finalize so a missed keyup cannot wedge the interaction.
  • The thumbnail effect no longer fingerprints the whole scene during an active interaction; it defers to the post-interaction run.

Testing

  • npm run typecheck
  • Manually tested the affected workflow

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.

1 participant