diff --git a/common/web/gesture-recognizer/src/engine/headless/gestures/matchers/gestureMatcher.ts b/common/web/gesture-recognizer/src/engine/headless/gestures/matchers/gestureMatcher.ts index 62ae9968c1e..e95427e5f67 100644 --- a/common/web/gesture-recognizer/src/engine/headless/gestures/matchers/gestureMatcher.ts +++ b/common/web/gesture-recognizer/src/engine/headless/gestures/matchers/gestureMatcher.ts @@ -6,10 +6,6 @@ import { GestureModel, GestureResolution, GestureResolutionSpec, RejectionDefaul import { ManagedPromise, TimeoutPromise } from "@keymanapp/web-utils"; import { FulfillmentCause, PathMatcher } from "./pathMatcher.js"; -// -// TODO: Next up - let's unit-test this bad boy! -// - export interface MatchResult { matched: boolean, action: GestureResolution @@ -65,12 +61,9 @@ export class GestureMatcher { this.pathMatchers = []; - let sourceTouchpoints: SimpleGestureSource[]; - if(source) { - sourceTouchpoints = source.touchpoints; - } else { - sourceTouchpoints = predecessor.pathMatchers.map((matcher) => matcher.source); - } + const sourceTouchpoints: SimpleGestureSource[] = source + ? source.touchpoints + : predecessor.pathMatchers.map((matcher) => matcher.source); let offset = 0; for(let touchpointIndex = 0; touchpointIndex < sourceTouchpoints.length; touchpointIndex++) { @@ -131,7 +124,7 @@ export class GestureMatcher { // Some gesture types may wish to restart with a new base item if they fail due to // it changing during its lifetime or due to characteristics of the contact-point's // path. - if(this.model.rejectionActions && this.model.rejectionActions[cause]) { + if(this.model.rejectionActions?.[cause]) { action = this.model.rejectionActions[cause]; action.item = 'none'; }