UI: Remove scroll to top on size change.

It wasn't actually used anywhere, and I don't see a reason for it now.
This commit is contained in:
Unknown W. Brackets 2021-09-27 23:39:33 -07:00
parent 374569ce7e
commit 931ba43216
4 changed files with 2 additions and 12 deletions

View file

@ -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;
}

View file

@ -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;

View file

@ -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);

View file

@ -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);