Since the contents of a ListView are virtualized, the ListView estimates the size of the scroll box's contents based on the on-screen elements. This can lead to some situations where DistanceFromBottom returns a negative number, preventing the box from scrolling to display the bottom element. More information is available on the linked UDN post, as well as a potential fix:
if (ReGenerateResults.ExactNumLinesOnScreen < 1.0f) { // We are be observing a single row which is larger than the available visible area, so we should calculate thumb size based on that const double VisibleSizeFraction = AllottedGeometry.GetLocalSize().Y / ReGenerateResults.LengthOfGeneratedItems; double ThumbSizeFraction = FMath::Min(VisibleSizeFraction, 1.0); const double OffsetFraction = CurrentScrollOffset / NumItemsBeingObserved; // If the visible size fraction is too large it will prevent the user from being able to scroll to the end of the list if (!ReGenerateResults.bGeneratedPastLastItem) { ThumbSizeFraction -= OffsetFraction; } ScrollBar->SetState( OffsetFraction, ThumbSizeFraction ); }
Incorrectly estimating the scroll bar's position may be unavoidable since off-screen list items are purely virtual and don't have an associated widget to measure, but distance from the bottom should never return a negative value.
[Link Removed] proposed a potential alternative solution to investigate, clamping both ThumbSizeFraction and OffsetFraction in SScrollBarTrack::SetSizes between 0 and 1.0.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-151120 in the post.
0 |
Component | UE - Editor - UI Systems - Slate |
---|---|
Affects Versions | 4.27 |
Created | May 4, 2022 |
---|---|
Updated | Dec 20, 2023 |