mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-11 21:46:23 +02:00
UI: Have scroll views directly remember their pos.
Kinda like checkboxes, cleaner this way.
This commit is contained in:
1 parent
4d5a63a74e
commit
fc78b408b2
4 files changed
+14
-16
No files matched your search
@@ -1017,17 +1017,13 @@ void ScrollView::PersistData(PersistStatus status, std::string anonId, PersistMa
|
||||
void ScrollView::SetVisibility(Visibility visibility) {
|
||||
ViewGroup::SetVisibility(visibility);
|
||||
|
||||
if (visibility == V_GONE && !rememberPosition_) {
|
||||
if (visibility == V_GONE && !rememberPos_) {
|
||||
// Since this is no longer shown, forget the scroll position.
|
||||
// For example, this happens when switching tabs.
|
||||
ScrollTo(0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
float ScrollView::GetScrollPosition() {
|
||||
return scrollPos_;
|
||||
}
|
||||
|
||||
void ScrollView::ScrollTo(float newScrollPos) {
|
||||
scrollTarget_ = newScrollPos;
|
||||
scrollToTarget_ = true;
|
||||
@@ -1141,6 +1137,8 @@ void ScrollView::Update() {
|
||||
|
||||
if (oldPos != scrollPos_)
|
||||
orientation_ == ORIENT_HORIZONTAL ? lastScrollPosX = scrollPos_ : lastScrollPosY = scrollPos_;
|
||||
if (rememberPos_)
|
||||
*rememberPos_ = scrollPos_;
|
||||
}
|
||||
|
||||
void AnchorLayout::Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert) {
|
||||
|
||||
Reference in new issue
Block a user