iOS: only the on-screen Duo pane reports split/unfolded; build 48
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4dfcfbf434
commit
d6da47db9d
2 files changed
+8
-3
No files matched your search
@@ -200,6 +200,7 @@ private struct DuoPane<Content: View>: View {
|
||||
@Environment(Ui.self) private var ui
|
||||
@AppStorage("duoSwap") private var swap = false
|
||||
@Environment(\.palette) private var p
|
||||
@State private var shown = false
|
||||
private var g: AppGraph { .shared }
|
||||
|
||||
var body: some View {
|
||||
@@ -231,8 +232,12 @@ private struct DuoPane<Content: View>: View {
|
||||
// The hinge gap shows whatever is behind; paint it so the two sides read as one.
|
||||
.background(p.bg.ignoresSafeArea())
|
||||
.animation(.spring(duration: 0.4, bounce: 0.1), value: flip)
|
||||
.onChange(of: hinge != nil, initial: true) { _, on in ui.setUnfolded(on) }
|
||||
.onChange(of: cut != nil, initial: true) { _, on in ui.setSplit(on) }
|
||||
// Every tab has its own pane and TabView keeps hidden ones alive, so only the one on
|
||||
// screen reports; a hidden one's stale size used to turn split off under the visible one.
|
||||
.onChange(of: hinge != nil) { _, on in if shown { ui.setUnfolded(on) } }
|
||||
.onChange(of: cut != nil) { _, on in if shown { ui.setSplit(on) } }
|
||||
.onAppear { shown = true; ui.setUnfolded(hinge != nil); ui.setSplit(cut != nil) }
|
||||
.onDisappear { shown = false }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user