mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 16:12:54 +08:00
Fix sections scroll container not handling fixed header in scrolls
This commit is contained in:
parent
05736fb84c
commit
3700c607d8
@ -149,13 +149,11 @@ namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
lastKnownScroll = null;
|
||||
|
||||
float fixedHeaderSize = FixedHeader?.BoundingBox.Height ?? 0;
|
||||
|
||||
// implementation similar to ScrollIntoView but a bit more nuanced.
|
||||
float top = scrollContainer.GetChildPosInContent(target);
|
||||
|
||||
float bottomScrollExtent = scrollContainer.ScrollableExtent - fixedHeaderSize;
|
||||
float scrollTarget = top - fixedHeaderSize - scrollContainer.DisplayableContent * scroll_y_centre;
|
||||
float bottomScrollExtent = scrollContainer.ScrollableExtent;
|
||||
float scrollTarget = top - scrollContainer.DisplayableContent * scroll_y_centre;
|
||||
|
||||
if (scrollTarget > bottomScrollExtent)
|
||||
scrollContainer.ScrollToEnd();
|
||||
@ -270,9 +268,13 @@ namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
if (!Children.Any()) return;
|
||||
|
||||
var newMargin = originalSectionsMargin;
|
||||
// if a fixed header is present, apply top padding for it
|
||||
// to make the scroll container aware of its displayable area.
|
||||
// (i.e. for page up/down to work properly)
|
||||
scrollContainer.Padding = new MarginPadding { Top = FixedHeader?.LayoutSize.Y ?? 0 };
|
||||
|
||||
newMargin.Top += (headerHeight ?? 0);
|
||||
var newMargin = originalSectionsMargin;
|
||||
newMargin.Top += (ExpandableHeader?.LayoutSize.Y ?? 0);
|
||||
newMargin.Bottom += (footerHeight ?? 0);
|
||||
|
||||
scrollContentContainer.Margin = newMargin;
|
||||
|
Loading…
Reference in New Issue
Block a user