Skip to content

Commit

Permalink
fix(web): longpress cancellation on extra touch should not cancel the…
Browse files Browse the repository at this point in the history
… extra touch
  • Loading branch information
jahorton committed Apr 18, 2024
1 parent 67dfa93 commit 006151f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class GestureMatcher<Type, StateToken = any> implements PredecessorMatch<

public get sources(): GestureSource<Type>[] {
return this.pathMatchers.map((pathMatch, index) => {
if(this.model.contacts[index].resetOnResolve) {
if(this.model.contacts[index].resetOnInstantFulfill) {
return undefined;
} else {
return pathMatch.source;
Expand Down Expand Up @@ -106,7 +106,7 @@ export class GestureMatcher<Type, StateToken = any> implements PredecessorMatch<
if(source && entry == source) {
// Due to internal delays that can occur when an incoming tap triggers
// completion of a previously-existing gesture but is not included in it
// (`resetOnResolve` mechanics), it is technically possible for a very
// (`resetOnInstantFulfill` mechanics), it is technically possible for a very
// quick tap to be 'complete' by the time we start trying to match
// against it on some devices. We should still try in such cases.
return source;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export interface GestureModel<Type, StateToken = any> {
* Only takes effect if a model instantly resolves or rejects upon being considered for
* inclusion in the model.
*/
resetOnResolve?: boolean,
resetOnInstantFulfill?: boolean,
/**
* Indicates that the corresponding GestureSource should be terminated whenever this GestureModel
* is successfully matched.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const SimpleTapModel: GestureModel = {
endOnResolve: true
}, {
model: specs.InstantResolutionModel,
resetOnResolve: true
resetOnInstantFulfill: true
}
],
resolutionAction: {
Expand Down
2 changes: 1 addition & 1 deletion web/src/engine/osk/src/input/gestures/browser/flick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export default class Flick implements GestureHandler {
let source: GestureSource<KeyElement> = baseSource;

sequence.on('complete', () => {
previewHost.cancel()
previewHost?.cancel()
});

this.sequence.on('stage', (result) => {
Expand Down
17 changes: 9 additions & 8 deletions web/src/engine/osk/src/input/gestures/specsForLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,8 @@ export function longpressModel(params: GestureParams, allowShortcut: boolean, al
},
endOnResolve: false
}, {
model: instantContactRejectionModel()
model: instantContactRejectionModel(),
resetOnInstantFulfill: true
}
],
resolutionAction: {
Expand Down Expand Up @@ -815,7 +816,7 @@ export function flickMidModel(params: GestureParams): GestureModel<any> {
endOnReject: true,
}, {
model: instantContactRejectionModel(),
resetOnResolve: true,
resetOnInstantFulfill: true,
}
],
rejectionActions: {
Expand Down Expand Up @@ -917,7 +918,7 @@ export function flickEndModel(params: GestureParams): GestureModel<any> {
},
{
model: instantContactResolutionModel(),
resetOnResolve: true
resetOnInstantFulfill: true
}
],
rejectionActions: {
Expand Down Expand Up @@ -980,7 +981,7 @@ export function multitapEndModel(params: GestureParams): GestureModel<any> {
endOnResolve: true
}, {
model: instantContactResolutionModel(),
resetOnResolve: true
resetOnInstantFulfill: true
}
],
rejectionActions: {
Expand Down Expand Up @@ -1015,7 +1016,7 @@ export function initialTapModel(params: GestureParams): GestureModel<any> {
endOnResolve: true
}, {
model: instantContactResolutionModel(),
resetOnResolve: true
resetOnInstantFulfill: true
}
],
sustainWhenNested: true,
Expand Down Expand Up @@ -1046,7 +1047,7 @@ export function simpleTapModel(params: GestureParams): GestureModel<any> {
endOnResolve: true
}, {
model: instantContactResolutionModel(),
resetOnResolve: true
resetOnInstantFulfill: true
}
],
sustainWhenNested: true,
Expand Down Expand Up @@ -1160,7 +1161,7 @@ export function modipressHoldModel(params: GestureParams): GestureModel<any> {
},
// The incoming tap belongs to a different gesture; we just care to know that it
// happened.
resetOnResolve: true
resetOnInstantFulfill: true
}
],
// To be clear: any time modipress-hold is triggered and the timer duration elapses,
Expand Down Expand Up @@ -1284,7 +1285,7 @@ export function modipressMultitapEndModel(params: GestureParams): GestureModel<a
},
// The incoming tap belongs to a different gesture; we just care to know that it
// happened.
resetOnResolve: true
resetOnInstantFulfill: true
}
],
resolutionAction: {
Expand Down

0 comments on commit 006151f

Please sign in to comment.