mirror of
https://github.com/libretro/ppsspp.git
synced 2025-03-05 23:18:32 +00:00
Allow using any touchId to scroll. Should help #9554.
This commit is contained in:
parent
e99f1c00ff
commit
f7da9204c1
@ -734,25 +734,27 @@ const float friction = 0.92f;
|
||||
const float stop_threshold = 0.1f;
|
||||
|
||||
void ScrollView::Touch(const TouchInput &input) {
|
||||
if ((input.flags & TOUCH_DOWN) && input.id == 0) {
|
||||
if ((input.flags & TOUCH_DOWN) && scrollTouchId_ == -1) {
|
||||
scrollStart_ = scrollPos_;
|
||||
inertia_ = 0.0f;
|
||||
scrollTouchId_ = input.id;
|
||||
}
|
||||
|
||||
Gesture gesture = orientation_ == ORIENT_VERTICAL ? GESTURE_DRAG_VERTICAL : GESTURE_DRAG_HORIZONTAL;
|
||||
|
||||
if (input.flags & TOUCH_UP) {
|
||||
if ((input.flags & TOUCH_UP) && input.id == scrollTouchId_) {
|
||||
float info[4];
|
||||
if (gesture_.GetGestureInfo(gesture, info)) {
|
||||
inertia_ = info[1];
|
||||
}
|
||||
scrollTouchId_ = -1;
|
||||
}
|
||||
|
||||
TouchInput input2;
|
||||
if (CanScroll()) {
|
||||
input2 = gesture_.Update(input, bounds_);
|
||||
float info[4];
|
||||
if (gesture_.GetGestureInfo(gesture, info) && !(input.flags & TOUCH_DOWN)) {
|
||||
if (gesture_.GetGestureInfo(gesture, info) && !(input.flags & TOUCH_DOWN) && input.id == scrollTouchId_) {
|
||||
float pos = scrollStart_ - info[0];
|
||||
scrollPos_ = pos;
|
||||
scrollTarget_ = pos;
|
||||
|
@ -222,17 +222,8 @@ private:
|
||||
// A scrollview usually contains just a single child - a linear layout or similar.
|
||||
class ScrollView : public ViewGroup {
|
||||
public:
|
||||
ScrollView(Orientation orientation, LayoutParams *layoutParams = 0) :
|
||||
ViewGroup(layoutParams),
|
||||
orientation_(orientation),
|
||||
scrollPos_(0),
|
||||
scrollStart_(0),
|
||||
scrollTarget_(0),
|
||||
scrollToTarget_(false),
|
||||
inertia_(0.0f),
|
||||
pull_(0.0f),
|
||||
lastViewSize_(0.0f),
|
||||
scrollToTopOnSizeChange_(false) {}
|
||||
ScrollView(Orientation orientation, LayoutParams *layoutParams = 0)
|
||||
: ViewGroup(layoutParams), orientation_(orientation) {}
|
||||
|
||||
void Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert) override;
|
||||
void Layout() override;
|
||||
@ -261,14 +252,15 @@ private:
|
||||
|
||||
GestureDetector gesture_;
|
||||
Orientation orientation_;
|
||||
float scrollPos_;
|
||||
float scrollStart_;
|
||||
float scrollTarget_;
|
||||
bool scrollToTarget_;
|
||||
float inertia_;
|
||||
float pull_;
|
||||
float lastViewSize_;
|
||||
bool scrollToTopOnSizeChange_;
|
||||
float scrollPos_ = 0.0f;
|
||||
float scrollStart_ = 0.0f;
|
||||
float scrollTarget_ = 0.0f;
|
||||
int scrollTouchId_ = -1;
|
||||
bool scrollToTarget_ = false;
|
||||
float inertia_ = 0.0f;
|
||||
float pull_ = 0.0f;
|
||||
float lastViewSize_ = 0.0f;
|
||||
bool scrollToTopOnSizeChange_ = false;
|
||||
};
|
||||
|
||||
class ViewPager : public ScrollView {
|
||||
|
Loading…
x
Reference in New Issue
Block a user