Skip to content

Commit

Permalink
Merge pull request #11854 from keymanapp/fix/web/simple-tap-fat-finge…
Browse files Browse the repository at this point in the history
…ring

fix(web): use fat-finger data with simple keypresses
  • Loading branch information
jahorton authored Jun 28, 2024
2 parents 1f3ad9e + f3cedac commit 1b2d025
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion common/web/input-processor/src/corrections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion web/src/engine/osk/src/visualKeyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,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);
}
Expand Down

0 comments on commit 1b2d025

Please sign in to comment.