mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
UI: Move scrollviews to top on hide.
This seems like a common scrolling decision.
This commit is contained in:
parent
2176920d5d
commit
60f00820f8
3 changed files with 17 additions and 5 deletions
|
@ -388,7 +388,7 @@ public:
|
|||
void SetEnabledPtr(bool *enabled) { enabledPtr_ = enabled; enabledMeansDisabled_ = false; }
|
||||
void SetDisabledPtr(bool *disabled) { enabledPtr_ = disabled; enabledMeansDisabled_ = true; }
|
||||
|
||||
void SetVisibility(Visibility visibility) { visibility_ = visibility; }
|
||||
virtual void SetVisibility(Visibility visibility) { visibility_ = visibility; }
|
||||
Visibility GetVisibility() const { return visibility_; }
|
||||
|
||||
const std::string &Tag() const { return tag_; }
|
||||
|
|
|
@ -851,6 +851,16 @@ void ScrollView::PersistData(PersistStatus status, std::string anonId, PersistMa
|
|||
}
|
||||
}
|
||||
|
||||
void ScrollView::SetVisibility(Visibility visibility) {
|
||||
ViewGroup::SetVisibility(visibility);
|
||||
|
||||
if (visibility == V_GONE) {
|
||||
// Since this is no longer shown, forget the scroll position.
|
||||
// For example, this happens when switching tabs.
|
||||
ScrollTo(0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollView::ScrollTo(float newScrollPos) {
|
||||
scrollTarget_ = newScrollPos;
|
||||
scrollToTarget_ = true;
|
||||
|
|
|
@ -246,8 +246,8 @@ public:
|
|||
|
||||
// Override so that we can scroll to the active one after moving the focus.
|
||||
bool SubviewFocused(View *view) override;
|
||||
|
||||
void PersistData(PersistStatus status, std::string anonId, PersistMap &storage) override;
|
||||
void SetVisibility(Visibility visibility) override;
|
||||
|
||||
// Quick hack to prevent scrolling to top in some lists
|
||||
void SetScrollToTop(bool t) { scrollToTopOnSizeChange_ = t; }
|
||||
|
@ -316,9 +316,11 @@ public:
|
|||
}
|
||||
|
||||
void SetCurrentTab(int tab) {
|
||||
tabs_[currentTab_]->SetVisibility(V_GONE);
|
||||
currentTab_ = tab;
|
||||
tabs_[currentTab_]->SetVisibility(V_VISIBLE);
|
||||
if (tab != currentTab_) {
|
||||
tabs_[currentTab_]->SetVisibility(V_GONE);
|
||||
currentTab_ = tab;
|
||||
tabs_[currentTab_]->SetVisibility(V_VISIBLE);
|
||||
}
|
||||
tabStrip_->SetSelection(tab);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue