From 931ba43216b8f5bd0578ad369ce6d5ca7587c8be Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 27 Sep 2021 23:39:33 -0700 Subject: [PATCH] UI: Remove scroll to top on size change. It wasn't actually used anywhere, and I don't see a reason for it now. --- Common/UI/ViewGroup.cpp | 8 ++------ Common/UI/ViewGroup.h | 4 ---- UI/ControlMappingScreen.cpp | 1 - UI/CwCheatScreen.cpp | 1 - 4 files changed, 2 insertions(+), 12 deletions(-) diff --git a/Common/UI/ViewGroup.cpp b/Common/UI/ViewGroup.cpp index 312f12c1d9..d3e1ad1b9e 100644 --- a/Common/UI/ViewGroup.cpp +++ b/Common/UI/ViewGroup.cpp @@ -800,9 +800,7 @@ void ScrollView::Layout() { switch (orientation_) { case ORIENT_HORIZONTAL: if (scrolled.w != lastViewSize_) { - if (scrollToTopOnSizeChange_) - ScrollTo(0.0f); - else if (rememberPos_) + if (rememberPos_) scrollPos_ = *rememberPos_; lastViewSize_ = scrolled.w; } @@ -811,9 +809,7 @@ void ScrollView::Layout() { break; case ORIENT_VERTICAL: if (scrolled.h != lastViewSize_) { - if (scrollToTopOnSizeChange_) - ScrollTo(0.0f); - else if (rememberPos_) + if (rememberPos_) scrollPos_ = *rememberPos_; lastViewSize_ = scrolled.h; } diff --git a/Common/UI/ViewGroup.h b/Common/UI/ViewGroup.h index aefad04c1b..4dca68bb35 100644 --- a/Common/UI/ViewGroup.h +++ b/Common/UI/ViewGroup.h @@ -295,9 +295,6 @@ public: NeighborResult FindScrollNeighbor(View *view, const Point &target, FocusDirection direction, NeighborResult best) override; - // Quick hack to prevent scrolling to top in some lists - void SetScrollToTop(bool t) { scrollToTopOnSizeChange_ = t; } - private: float ClampedScrollPos(float pos); @@ -312,7 +309,6 @@ private: float inertia_ = 0.0f; float pull_ = 0.0f; float lastViewSize_ = 0.0f; - bool scrollToTopOnSizeChange_ = false; float *rememberPos_ = nullptr; static float lastScrollPosX; diff --git a/UI/ControlMappingScreen.cpp b/UI/ControlMappingScreen.cpp index 1aee00dedd..a9edac12a9 100644 --- a/UI/ControlMappingScreen.cpp +++ b/UI/ControlMappingScreen.cpp @@ -250,7 +250,6 @@ void ControlMappingScreen::CreateViews() { rightScroll_ = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)); rightScroll_->SetTag("ControlMapping"); - rightScroll_->SetScrollToTop(false); LinearLayout *rightColumn = new LinearLayoutList(ORIENT_VERTICAL); rightScroll_->Add(rightColumn); diff --git a/UI/CwCheatScreen.cpp b/UI/CwCheatScreen.cpp index ba02587609..0a1a1e85c3 100644 --- a/UI/CwCheatScreen.cpp +++ b/UI/CwCheatScreen.cpp @@ -96,7 +96,6 @@ void CwCheatScreen::CreateViews() { rightScroll_ = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT, 0.5f)); rightScroll_->SetTag("CwCheats"); - rightScroll_->SetScrollToTop(false); rightScroll_->RememberPosition(&g_Config.fCwCheatScrollPosition); LinearLayout *rightColumn = new LinearLayoutList(ORIENT_VERTICAL, new LinearLayoutParams(200, FILL_PARENT, actionMenuMargins)); rightScroll_->Add(rightColumn);