TouchGestureTracker follows two fingers and reports the pan, scale and rotation since the previous update around their midpoint. The Android window tracks every finger, sends a gesture while two or more touch the screen and releases the pointer the first finger was holding, so one finger keeps acting as a pointer. Gestures travel through the input coalescer, which merges consecutive updates, to a new Gesture UI event delivered to the widget under the fingers where the gesture began. Gesture events reach the UI before pointer events from the same frame.
27 lines
749 B
C++
27 lines
749 B
C++
#pragma once
|
|
|
|
#include "InputCodes.hpp"
|
|
#include "PointerSample.hpp"
|
|
#include "TouchGesture.hpp"
|
|
#include "Vec.hpp"
|
|
|
|
#include <string>
|
|
|
|
namespace tp {
|
|
|
|
class WindowInputObserver {
|
|
public:
|
|
virtual ~WindowInputObserver() = default;
|
|
|
|
virtual void onPointerSample(const PointerSample& sample) {}
|
|
virtual void onPointerMoved(Vec2F contentPosition) {}
|
|
virtual void onPointerLeft() {}
|
|
virtual void onPointerButton(InputID button, bool pressed) {}
|
|
virtual void onScrolled(Vec2F delta) {}
|
|
virtual void onKey(InputID key, bool pressed) {}
|
|
virtual void onKeyRepeat(InputID key) {}
|
|
virtual void onText(const std::string& utf8) {}
|
|
virtual void onKeyboardFocus(bool focused) {}
|
|
virtual void onGesture(const TouchGesture& gesture) {}
|
|
};
|
|
}
|