feat(demo): improve cursor movement and typing realism#4783
Merged
gregpriday merged 3 commits intodevelopfrom Apr 2, 2026
Merged
feat(demo): improve cursor movement and typing realism#4783gregpriday merged 3 commits intodevelopfrom
gregpriday merged 3 commits intodevelopfrom
Conversation
- Add Fitts's Law auto-duration computation when durationMs is omitted - Add 1D value noise for perpendicular micro-jitter on cursor paths - Scale keyframe count dynamically with distance (10-60 steps) - Split long moves (>300px) into ballistic + acquisition phases - Add post-click settling drift (1-2px, 150ms ease-out) - Replace uniform typing delay with Gaussian-distributed context-aware delays - Make durationMs optional on DemoMoveToPayload and DemoMoveToSelectorPayload - Pass target element width to Fitts's Law for moveToSelector - Add 7 new tests covering Fitts's Law, two-phase movement, settling, typing variance
- Make durationMs optional in shared/types/ipc/api.ts ElectronAPI type - Add mid-word burst typing multiplier (0.7x for consecutive letters) - Guard against cps=0 causing Infinity delay
- Fix animateSpy mock type to avoid TS2493 tuple index errors - Format DemoCursor.tsx with prettier
01aa7db to
86242f3
Compare
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
1000 / cpskeystroke delay with Gaussian-distributed base delays, longer pauses after spaces and punctuation, burst-mode multiplier for mid-word characters, and occasional hesitation pausesResolves #4776
Changes
src/components/Demo/DemoCursor.tsx— all movement, typing, and click-feedback logicsrc/components/Demo/__tests__/DemoCursor.test.tsx— test coverage for the new behaviourselectron/preload.cts,shared/types/ipc/api.ts, andshared/types/ipc/demo.tsTesting
Unit tests updated and passing. The Fitts's Law scaling, noise generation, two-phase movement, variable keystroke timing, and click-settling are all covered in the test suite.