-
Notifications
You must be signed in to change notification settings - Fork 26
Description
Hi,
I'm using a simple horizontal split set up like this:
@State private var minPFraction = 0.1 // 100 at default width of 1000
--snip--
VStack {
Split(primary: {
Color.teal
}, secondary: {
Color.green
})
.constraints(minPFraction: minPFraction, priority: .left, dragToHideP: true)
.fraction(fraction)
.hide(hide)
Button("Toggle Hide") {
withAnimation {
if(hide.side == .left) {
hide.toggle()
} else {
hide.hide(.left)
}
}
}
}
When I click hide to toggle hiding the left split it hides but the whole split narrows in width revealing the content below the split view on the right side:
Screen.Recording.2023-12-10.at.15.51.51.mov
On hiding the left split seems to resize to minPFraction. And when hiding by dragging to the left, that hidden state seems not to be in sync with whatever .hide() is using as clicking the hide button doesn't unhide the left split, but does what looks like another hide operation.
Is there something obvious I am missing? :)
Thanks!
PS
As an aside: it was a bit confusing to get the left split to hide! hide.toggle() always hides the right view, regardless of which one has priority (I expect in most scenario's the split having priority is the one to be hidden -- but I could be wrong). I did get it to work with the code above, but IMHO an API like .toggle(.left) would be cleaner.