TouchGestures class
#include <Jazz2/Editor/Input/TouchGestures.h>
Tells what the fingers on a touch screen do in the level editor.
One finger is the pointer: on the interface right away, over the level only once it moved a little or stayed a moment, so a second finger that comes soon after doesn't paint anything — a quick touch is a click. Two fingers move the view and zoom it by pinching, a short tap of two fingers undoes, of three redoes, and a finger held still opens a menu around it.
Fingers are told apart by their identifiers as the events list them, not by the kind of the event, which backends report in different ways.
Public static variables
- static float Slop constexpr
- Most pixels a finger moves for a touch to be still a tap, at the scale of the interface 1.
Constructors, destructors, conversion operators
Public functions
- void OnTouchEvent(const TouchEvent& event, Vector2f screenSize, float scale)
- Passes a touch event, with the size of the screen the positions are relative to.
- void Update(float timeMult)
- Advances time, for the moment a finger waits and a long press.
- auto IsActive() const -> bool
- Returns
truewhile a finger is on the screen.
Public variables
- Function<bool(Vector2f)> IsOverInterface
- Returns whether a position is over the interface, a finger that starts there is a pointer only, it never pans.
- Function<void(Vector2f)> PointerDown
- Presses the pointer.
- Function<void(Vector2f)> PointerMove
- Moves the pointer.
- Function<void(Vector2f)> PointerUp
- Releases the pointer.
- Function<void()> PointerCancel
- Cancels what the pointer started, a second finger came.
- Function<void(Vector2f, Vector2f, float)> PanZoom
- Moves the view by a distance in pixels of the screen and zooms it by a factor around a point.
-
Function<void(std::
int32_t)> Tap - Several fingers tapped together, with their number.
- Function<void(Vector2f)> LongPress
- A finger was held still at a position.