@georgie, this might be relevant as you look into genericised camera inputs. It might be interesting to allow a user to create a CameraInputs class heavily using one or more of the libraries mentioned below. At minimim, I think this provides insight to the types of possible gestures that current input classes don’t cover (multipointer multitaps, rotate, swipe, press). And there are PointerEvent properties that go unused (width, height, “pen”, pressure, tilt, twist, and many others).
PointerEvent
JavaScript provides PointerEvents while additional libraries convert those events into more complex gestures, simplifying the logic in code that uses those gestures. These libraries could provide a model for Camera Inputs and/or InputManagers.
Here is a summary from looking around the web at PointerEvemts and four different gesture libraries.
Events from JavaScript
To support both touch and mouse across all types of devices, use pointer events instead.
Note: It’s important to note that in many cases, both pointer and mouse events get sent (in order to let non-pointer-specific code still interact with the user). If you use pointer events, you should call preventDefault() to keep the mouse event from being sent as well.
Properties
PointerEvent.pointerType (“mouse”, “pen”, “touch”)
PointerEvent.isPrimary
PointerEvent.persistentDeviceId
PointerEvent.pointerId
PointerEvent.altitudeAngle
PointerEvent.azimuthAngle
PointerEvent.width
PointerEvent.height
PointerEvent.pressure
PointerEvent.tangentialPressure
PointerEvent.tiltX
PointerEvent.tiltY
PointerEvent.twist
Events
type: pointer___, enter/leave, down/up, move, cancel, over/out (stylus hover range),
over/leave - described as opposites, though over/out would make more sense
enter/out - described as opposites, though enter/leave would make more sense
gotpointercapture, lostpointercapture, pointerrawupdate
Survey of libraries
These take the Pointer Events and process them to recognize various common “gestures” and generate events. Libraries usually make parameters (e.g. timing, direction) available for fine-grained configuration.
| type | thefinger.dev | hammerjs | zingtouch | deeptissuejs |
|---|---|---|---|---|
| tap | Y | Y | Y | Y |
| double tap | Y | taps | numInputs? | Y |
| press | Y | Y | tap hold | |
| long press | Y | time | ||
| flick / swipe | drag:speed | Y | Y | swipe (u/d/l/r) |
| drag / pan | drag/pan | pan | pan | move (h/v) |
| pinch & spread | Y | Y | distance | scale |
| rotate | Y | Y | Y | Y |
| two finger tap | Y | pointers | numInputs? | |
| double tap & drag | Y | taps & pointers | ||
| License | ISC | MIT | MIT | Apache License 2.0 |
Feature list from docs
• tap
• double tap
• press
• long press
• flick / swipe
• drag
• pinch & spread
• rotate
• pan
• two finger tap
• double tap & drag
The default set contains tap, doubletap, pan, swipe, press, pinch [spread] and rotate recognizer instances.
press: Recognized when the pointer is down for x ms without any movement.
swipe: Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.
tap, rotate, pinch/expand, pan, swipe
tap, double tap, tap hold, move (h/v), swipe (u/d/l/r), rotate, scale