1#include "ListElement.hpp"
11 ret |= this->handleInertiaScroll(event);
24 if (event->isKeyDown())
27 event->wheelScroll += (SPEED *
event->held(UP_BUTTON) - SPEED *
event->held(DOWN_BUTTON));
29 ret |=
event->held(UP_BUTTON) ||
event->held(DOWN_BUTTON);
35bool ListElement::handleInertiaScroll(
InputEvents* event)
40 if (event->isTouchDown())
43 if (event->xPos < elem->xAbs)
49 elem->initialTouchDown =
event->yPos;
54 else if (event->isTouchDrag())
59 if (this->initialTouchDown >= 0 && (abs(event->yPos - this->initialTouchDown) < 10 / SCALER))
62 this->initialTouchDown = -1;
74 else if (event->isTouchUp())
82 if (elem->y > minYScroll)
101 if (elem->y > minYScroll)
102 elem->y = minYScroll;
107 if (ret)
event->isScrolling =
true;
109 if (event->wheelScroll != 0)
112 elem->y +=
event->wheelScroll * 10;
113 if (elem->y > minYScroll)
114 elem->y = minYScroll;
115 event->wheelScroll *= 0.95;
117 if (abs(event->wheelScroll) < 0.1)
118 event->wheelScroll = 0;
virtual bool process(InputEvents *event)
process any input that is received for this element
bool hidden
whether this element should skip rendering or not
bool dragging
whether or not this element is currently being dragged
int elasticCounter
how much time is left in an elastic-type flick/scroll set by the last distance traveled in a scroll,...
int lastMouseY
the last Y, X coordinate of the mouse (from a drag probably)
bool process(InputEvents *event)
process any input that is received for this element