From b4ed832ed93710b91b1791179e0d9efaf24d9805 Mon Sep 17 00:00:00 2001 From: "Joshua A. Horton" Date: Fri, 12 Apr 2024 08:37:58 +0700 Subject: [PATCH] fix(web): fixes up-flick shortcut issue for longpress when keys support downflicks --- web/src/engine/osk/src/input/gestures/specsForLayout.ts | 3 ++- web/src/engine/osk/src/visualKeyboard.ts | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/web/src/engine/osk/src/input/gestures/specsForLayout.ts b/web/src/engine/osk/src/input/gestures/specsForLayout.ts index c5688e406f6..9284265e3ac 100644 --- a/web/src/engine/osk/src/input/gestures/specsForLayout.ts +++ b/web/src/engine/osk/src/input/gestures/specsForLayout.ts @@ -632,7 +632,8 @@ export function specialKeyEndModel(params: GestureParams): GestureModel { export function longpressModel(params: GestureParams, allowShortcut: boolean, allowRoaming: boolean): GestureModel { const base: GestureModel = { id: 'longpress', - resolutionPriority: 0, + // Needs to beat flick-start priority. + resolutionPriority: 4, contacts: [ { model: { diff --git a/web/src/engine/osk/src/visualKeyboard.ts b/web/src/engine/osk/src/visualKeyboard.ts index 67ae9f48fc0..1b61a722c4d 100644 --- a/web/src/engine/osk/src/visualKeyboard.ts +++ b/web/src/engine/osk/src/visualKeyboard.ts @@ -1280,8 +1280,13 @@ export default class VisualKeyboard extends EventEmitter implements Ke const paddingZone = this.gestureEngine.config.maxRoamingBounds as PaddedZoneSource; paddingZone.updatePadding([-0.333 * this.currentLayer.rowHeight]); + /* + Note: longpress.flickDist needs to be no greater than flick.startDist. + Otherwise, the longpress up-flick shortcut will not work on keys that + support flick gestures. (Such as sil_euro_latin 3.0+) + */ this.gestureParams.longpress.flickDist = 0.25 * this.currentLayer.rowHeight; - this.gestureParams.flick.startDist = 0.15 * this.currentLayer.rowHeight; + this.gestureParams.flick.startDist = 0.25 * this.currentLayer.rowHeight; this.gestureParams.flick.dirLockDist = 0.35 * this.currentLayer.rowHeight; this.gestureParams.flick.triggerDist = 0.75 * this.currentLayer.rowHeight; }