natinusala / borealis

Hardware accelerated, controller and TV oriented UI library for PC and Nintendo Switch (libnx)
Apache License 2.0
255 stars 81 forks source link

legacy: ScrollView: fix content view start scroll offset when the sidebar item is initially focused. #167

Closed DarkMatterCore closed 3 years ago

DarkMatterCore commented 3 years ago

Previous behaviour would mistakenly use boundary values from the focused SidebarItem instead of a child from the ScrollView's content view, leading to content views not being initially rendered at scroll offset 0.0f.

This issue becomes evident when using long content views for SidebarItem elements beyond the first one.

The problem is fixed by checking if the focused view's parent matches the ScrollView's content view. If the focused item isn't a child of the content view, currentSelectionMiddleOnScreen is set to the content view's Y coordinate.

DarkMatterCore commented 3 years ago

I'm switching to main.