mirror of
https://github.com/yattee/yattee.git
synced 2026-11-04 10:57:18 +00:00
Keep the video info carousel aligned across window resizes
The carousel's lazy stack kept the old widths of cards it had laid out off-screen, so after a resize (tab bar to split view sidebar on iPad, rotation) every later card sat at a stale offset and the current card landed beside the viewport. The stack now takes a new identity per card width, and the existing re-snap aligns the current card. Swapping between the tab bar and the sidebar also rebuilds the page, which reset the carousel to the video it was opened on. The page's position and continuation-loaded videos now live on its queue context, fresh for every push, so a rebuilt page resumes where it was.
This commit is contained in:
@@ -67,6 +67,13 @@ final class NavigationRouter {
|
||||
|
||||
/// Pushes a destination onto the selected section's stack.
|
||||
func push(_ destination: NavigationDestination) {
|
||||
var destination = destination
|
||||
// A row hands out the same context on every tap until it re-renders,
|
||||
// so a page pushed again must not inherit the earlier page's position.
|
||||
if case .video(let source, var queueContext?) = destination {
|
||||
queueContext.pageState = VideoInfoPageState()
|
||||
destination = .video(source, queueContext: queueContext)
|
||||
}
|
||||
stacks[selection.id, default: []].append(destination)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user