-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
/
InertialScrollingHandler.h
49 lines (40 loc) · 1.32 KB
/
InertialScrollingHandler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* Copyright (C) 2011-2018 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#pragma once
#include "utils/Geometry.h"
#include "utils/Vector.h"
#include <deque>
class CApplication;
class CAction;
class CInertialScrollingHandler
{
friend class CApplication;
public:
CInertialScrollingHandler();
bool IsScrolling(){return m_bScrolling;}
private:
bool CheckForInertialScrolling(const CAction* action);
bool ProcessInertialScroll(float frameTime);
//-------------------------------------------vars for inertial scrolling animation with gestures
bool m_bScrolling = false; //flag indicating that we currently do the inertial scrolling emulation
bool m_bAborting = false; //flag indicating an abort of scrolling
CVector m_iFlickVelocity;
struct PanPoint
{
unsigned int time;
CVector velocity;
PanPoint(unsigned int time, CVector velocity)
: time(time), velocity(velocity) {}
unsigned int TimeElapsed() const;
};
std::deque<PanPoint> m_panPoints;
CPoint m_iLastGesturePoint;
CVector m_inertialDeacceleration;
unsigned int m_inertialStartTime = 0;
float m_timeToZero = 0.0f;
};