mirror of
https://github.com/yattee/yattee.git
synced 2026-02-19 17:29:45 +00:00
Fix player dismiss gesture stuck after panel dismiss with comments expanded
Reset isCommentsExpanded and commentsFrame on the NavigationCoordinator directly when the portrait panel is dismissed, since PortraitDetailsPanel owns its own @State that doesn't sync back through .onChange during dismiss. Also track comments overlay frame via GeometryReader so the dismiss gesture can allow swipes outside the comments area instead of blanket-blocking.
This commit is contained in:
@@ -256,6 +256,23 @@ struct PortraitDetailsPanel: View {
|
||||
}
|
||||
.opacity(expanded ? 1 : 0)
|
||||
.allowsHitTesting(expanded)
|
||||
.background(
|
||||
GeometryReader { commentsGeometry in
|
||||
Color.clear
|
||||
.onChange(of: commentsGeometry.frame(in: .global)) { _, newFrame in
|
||||
if isCommentsExpanded {
|
||||
appEnvironment?.navigationCoordinator.commentsFrame = newFrame
|
||||
}
|
||||
}
|
||||
.onChange(of: isCommentsExpanded) { _, expanded in
|
||||
if expanded {
|
||||
appEnvironment?.navigationCoordinator.commentsFrame = commentsGeometry.frame(in: .global)
|
||||
} else {
|
||||
appEnvironment?.navigationCoordinator.commentsFrame = .zero
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
.animation(.smooth(duration: 0.3), value: isCommentsExpanded)
|
||||
.onChange(of: video.id) { _, _ in
|
||||
@@ -521,6 +538,7 @@ struct PortraitDetailsPanel: View {
|
||||
}
|
||||
|
||||
private func collapseComments() {
|
||||
appEnvironment?.navigationCoordinator.commentsFrame = .zero
|
||||
withAnimation(.smooth(duration: 0.3)) {
|
||||
isCommentsExpanded = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user