Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(web): new abstraction - corrective layouts 🐵 #9778

Merged
merged 10 commits into from
Oct 24, 2023

Conversation

jahorton
Copy link
Contributor

With the new incoming types of gestures, it's important that we prepare a reasonable way to model them alongside the predictive-text engine. While we've long had a good setup in place for standard keyboard layers... none of the other uses cases have particularly great models.

Our existing longpress solution:

// A temp-hack, as this was noted just before 14.0's release.
// Since a more... comprehensive solution would be way too complex this late in the game,
// this provides a half-decent stopgap measure.
//
// Will not correct to nearby subkeys; only includes the selected subkey and its base keys.
// Still, better than ignoring them both for whatever base key is beneath the final cursor location.

Yeah, that's not ideal. Surely we can do better.

So, to provide a good path forward for our existing longpresses and for newly-incoming multitaps and flicks, this PR creates abstractions for the minimal requirements of the key-distance algorithm at the core of the fat-finger algorithm. It also extracts the key-correction methods from ActiveLayer, allowing them to operate independently of any specific type - they'll now utilize the new abstractions.

By doing so, it becomes possible to build appropriate values for the new abstraction for our subkey menus, allowing true fat-finger calculations for subkeys. (A major improvement over simply maintaining the existing hack.) It also provides a baseline for further enhancements we may wish to consider for corrections involving multitaps and flicks. Note that none of the ideas in this paragraph are implemented within this PR, though - I've kept the scope limited to just the refactor needed to facilitate implementations thereof.

An extra benefit from this refactor - the key-distance types and algorithms at the heart of the fat-finger algorithm have been moved to input-processor, the same package containing the fat-finger algorithm. As input-processor's primary role is facilitating predictive-text and acting as the interface between keystroke-engine and predictive-text, it's the perfect place for them. (Not that input-processor is the perfect name, given the package's role.)

@keymanapp-test-bot skip

@jahorton jahorton added this to the A17S24 milestone Oct 17, 2023
common/web/input-processor/src/correctionLayout.ts Outdated Show resolved Hide resolved
common/web/input-processor/src/corrections.ts Outdated Show resolved Hide resolved
Base automatically changed from feat/web/longpress-restoration to feature-gestures October 20, 2023 09:21
@jahorton jahorton merged commit 45efd9a into feature-gestures Oct 24, 2023
18 of 19 checks passed
@jahorton jahorton deleted the refactor/web/corrective-layout-abstraction branch October 24, 2023 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants