Input · function

classifyRightGesture

Classify a drag from its travel and duration.

Explained in Moving things.

function classifyRightGesture(dx: number, dy: number, elapsedMs: number, options: RightGestureOptions): RightGesture
import { classifyRightGesture } from '@driftengine/core';

Parameters

ParameterTypeDescription
dxnumber
dynumber
elapsedMsnumber
optionsRightGestureOptions

In depth

The bias is deliberate and one-way: when in doubt, it is a look. Looking is continuous and constant, the secondary flick is occasional, and the two failure modes are not equal — a missed flick costs one slide, while a look wrongly eaten costs the camera for the whole gesture, which is felt as the controls being broken rather than as a missed input.

That asymmetry is exactly what went wrong: any quick downward drag was read as a flick, so trying to look down quickly did not move the camera at all. Looking left and right stayed fine, because no gesture competes for it.