Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix onUp in Fling #2709

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/web/handlers/FlingGestureHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { AdaptedEvent, Config } from '../interfaces';
import GestureHandler from './GestureHandler';

const DEFAULT_MAX_DURATION_MS = 800;
const DEFAULT_MIN_ACCEPTABLE_DELTA = 160;
const DEFAULT_MIN_ACCEPTABLE_DELTA = 32;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though it should be fine (and also this functionality can be implemented using Pan), I think it would be better if users could change this value. What do you think @j-piasecki?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, having it set to 160 is a bit much. We could make it also use velocity to determine whether to activate (if the distance was shorter than the minimum delta, but the gesture was fast). Anyway, that's something for another PR, if we want to do this at all.

const DEFAULT_DIRECTION = Direction.RIGHT;
const DEFAULT_NUMBER_OF_TOUCHES_REQUIRED = 1;

Expand Down Expand Up @@ -141,11 +141,11 @@ export default class FlingGestureHandler extends GestureHandler {
}

private onUp(event: AdaptedEvent): void {
this.tracker.removeFromTracker(event.pointerId);
if (this.currentState !== State.BEGAN) {
return;
if (this.currentState === State.BEGAN) {
this.endFling();
}
this.endFling();

this.tracker.removeFromTracker(event.pointerId);
}

public activate(force?: boolean): void {
Expand Down
Loading