From fd0a9743a2e81348ebfdb8a3156ff0da5f9c096e Mon Sep 17 00:00:00 2001 From: Mikael Pettersson Date: Tue, 10 Mar 2020 10:25:31 +0100 Subject: [PATCH] Touch: Added a firstInput so that if we ever get more than max amount of inputs in our Deque, we will still have our first point stored (for pinching around a start-centroid mainly) --- include/openspace/util/touch.h | 1 + src/util/touch.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/openspace/util/touch.h b/include/openspace/util/touch.h index a7f8500a93..a7e8bc0735 100644 --- a/include/openspace/util/touch.h +++ b/include/openspace/util/touch.h @@ -80,6 +80,7 @@ public: private: //A deque of recorded inputs. Adding newer points to the front of the queue std::deque _inputs; + TouchInput _firstInput; size_t _touchDeviceId; size_t _fingerId; diff --git a/src/util/touch.cpp b/src/util/touch.cpp index d5381daa01..f08c5cab03 100644 --- a/src/util/touch.cpp +++ b/src/util/touch.cpp @@ -73,6 +73,7 @@ float TouchInput::angleToPos(float otherX, float otherY) const { TouchInputHolder::TouchInputHolder(TouchInput input) : _inputs{ input } + , _firstInput(input) , _touchDeviceId(input.touchDeviceId) , _fingerId(input.fingerId) {} @@ -182,7 +183,7 @@ size_t TouchInputHolder::numInputs() const { } const TouchInput& TouchInputHolder::firstInput() const { - return _inputs.back(); + return _firstInput; } const TouchInput& TouchInputHolder::latestInput() const {