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)
This commit is contained in:
Mikael Pettersson
2020-03-10 10:25:31 +01:00
parent a991a80525
commit fd0a9743a2
2 changed files with 3 additions and 1 deletions

View File

@@ -80,6 +80,7 @@ public:
private:
//A deque of recorded inputs. Adding newer points to the front of the queue
std::deque<TouchInput> _inputs;
TouchInput _firstInput;
size_t _touchDeviceId;
size_t _fingerId;

View File

@@ -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 {