input: Add fully configurable trackpad gestures (#11490)
Adds configurable trackpad gestures
This commit is contained in:
parent
378e130f14
commit
81bf4eccba
60 changed files with 2518 additions and 940 deletions
43
src/managers/input/trackpad/gestures/ITrackpadGesture.hpp
Normal file
43
src/managers/input/trackpad/gestures/ITrackpadGesture.hpp
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#pragma once
|
||||
|
||||
#include "../../../../devices/IPointer.hpp"
|
||||
#include "../GestureTypes.hpp"
|
||||
|
||||
class ITrackpadGesture {
|
||||
public:
|
||||
virtual ~ITrackpadGesture() = default;
|
||||
|
||||
struct STrackpadGestureBegin {
|
||||
// this has update because we wait for the delta
|
||||
const IPointer::SSwipeUpdateEvent* swipe = nullptr;
|
||||
const IPointer::SPinchUpdateEvent* pinch = nullptr;
|
||||
eTrackpadGestureDirection direction = TRACKPAD_GESTURE_DIR_NONE;
|
||||
float scale = 1.F;
|
||||
};
|
||||
|
||||
struct STrackpadGestureUpdate {
|
||||
const IPointer::SSwipeUpdateEvent* swipe = nullptr;
|
||||
const IPointer::SPinchUpdateEvent* pinch = nullptr;
|
||||
eTrackpadGestureDirection direction = TRACKPAD_GESTURE_DIR_NONE;
|
||||
float scale = 1.F;
|
||||
};
|
||||
|
||||
struct STrackpadGestureEnd {
|
||||
const IPointer::SSwipeEndEvent* swipe = nullptr;
|
||||
const IPointer::SPinchEndEvent* pinch = nullptr;
|
||||
eTrackpadGestureDirection direction = TRACKPAD_GESTURE_DIR_NONE;
|
||||
float scale = 1.F;
|
||||
};
|
||||
|
||||
virtual void begin(const STrackpadGestureBegin& e);
|
||||
virtual void update(const STrackpadGestureUpdate& e) = 0;
|
||||
virtual void end(const STrackpadGestureEnd& e) = 0;
|
||||
|
||||
virtual float distance(const STrackpadGestureBegin& e);
|
||||
virtual float distance(const STrackpadGestureUpdate& e);
|
||||
|
||||
virtual bool isDirectionSensitive();
|
||||
|
||||
protected:
|
||||
float m_lastPinchScale = 1.F, m_scale = 1.F;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue