Merge pull request #11871 from keymanapp/fix/web/cherry-pick/simple-tap-fat-fingering

fix(web): use fat-finger data with simple keypresses 🍒  🏠
This commit is contained in:
Joshua Horton 2024-06-28 08:41:17 +07:00 • committed by GitHub
commit 4224dc6ac2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View file

@ -80,7 +80,12 @@ export function distributionFromDistanceMaps(squaredDistMaps: Map<ActiveKeyBase,
for(let key of squaredDistMap.keys()) {
// We've found that in practice, dist^-4 seems to work pretty well. (Our input has dist^2.)
// (Note: our rule of thumb here has only been tested for layout-based distances.)
const entry = 1 / (Math.pow(squaredDistMap.get(key), 2) + 1e-6); // Prevent div-by-0 errors.
//
// The 3e-5 fudge-factor may seem a bit high, but it has two purposes:
// 1. Prevent div-by-0 errors
// 2. Ensures that the main key's probability doesn't get SO high that we don't
// consider correcting to immediate neighbors, even if perfectly accurate.
const entry = 1 / (Math.pow(squaredDistMap.get(key), 2) + 3e-5);
totalMass += entry;
// In case of duplicate key IDs; this can occur if multiple sets are specified.

View file

@ -637,7 +637,7 @@ export default class VisualKeyboard extends EventEmitter<EventMap> implements Ke
try {
shouldLockLayer && this.lockLayer(true);
// Once the best coord to use for fat-finger calculations has been determined:
keyResult = this.modelKeyClick(gestureStage.item, coord);
keyResult = this.modelKeyClick(gestureStage.item, coord, correctionKeyDistribution);
} finally {
shouldLockLayer && this.lockLayer(false);
}