Input · interface
TouchControlsOptions
Explained in Moving things.
interface TouchControlsOptionsimport type { TouchControlsOptions } from '@driftengine/core';Properties
| Name | Type | Description |
|---|---|---|
stickBaseoptional | HTMLElement | The two nodes the stick is drawn with, when a caller wants one drawn.MoreOptional, and that is a correction rather than a convenience. These were positional
arguments and read as dependencies — a consumer who could not reach the page concluded the
class needed two elements to work, and constructed two So absent means the stick has no visible representation and the controls work exactly as they
did, which is what a consumer drawing its own HUD, drawing none, or forbidden the page wants.
|
stickNuboptional | HTMLElement | |
splitRatiooptional | number | Fraction of the input surface assigned to the dynamic stick. |
stickRadiusPxoptional | number | |
stickDeadzoneoptional | number | |
gestureMovePxoptional | number | |
holdResolveMsoptional | number | |
tapMaxMsoptional | number | How long a touch may last and still fire the primary on release.MoreThe press fires on release, so this duration is the action's input latency, and a caller whose action has a grace window of its own — a platformer's coyote time — wants the two sized against each other. Set it past that window and a tap begun at the edge of a drop resolves after the body is unjumpably in the air. |
fireOnHoldoptional | boolean | Whether holding the second zone still also fires the primary, or only holds it.MoreThe default is only-holds, and it is the fix for a real complaint from phone testing: a still thumb kept firing the primary action, so there was no way to hold position and look. A thumb placed down and held is what looking around starts with, so resolving it into a press fires the action every time somebody lines up a camera move. There is no threshold that separates "still thumb" from "about to look", because they are the same input. A tap still fires on release, which is where the intent actually is; and the hold
still reports The promotion is not a verdict, and reading it as one is what later ate the tap:
a touch promoted to the hold and released quickly is still a tap, because the
player's thumb did the thing a tap is. See |
swipeMaxMsoptional | number | |
swipeDominanceoptional | number | Vertical travel divided by horizontal travel required for a swipe. |