Debian Codegraph @

xbmc/input/InertialScrollingHandler.h

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