Ensure the final scroll target is used when checking for whether too far down

This commit is contained in:
Dean Herbert 2021-08-20 17:56:35 +09:00
parent 03e6ca5ba9
commit 591ba8cb09
1 changed files with 4 additions and 3 deletions

View File

@ -154,12 +154,13 @@ public void ScrollTo(Drawable target)
// implementation similar to ScrollIntoView but a bit more nuanced.
float top = scrollContainer.GetChildPosInContent(target);
var bottomScrollExtent = scrollContainer.ScrollableExtent - fixedHeaderSize;
float bottomScrollExtent = scrollContainer.ScrollableExtent - fixedHeaderSize;
float scrollTarget = top - fixedHeaderSize - scrollContainer.DisplayableContent * scroll_y_centre;
if (top > bottomScrollExtent)
if (scrollTarget > bottomScrollExtent)
scrollContainer.ScrollToEnd();
else
scrollContainer.ScrollTo(top - fixedHeaderSize - scrollContainer.DisplayableContent * scroll_y_centre);
scrollContainer.ScrollTo(scrollTarget);
if (target is T section)
lastClickedSection = section;