Closed JosephDuffy closed 1 year ago
I'm having exactly the same issue here. Only with me it's happening with different heights.
I was able to make it a little bit less annoying by adding a fade animation when moving between panes.
It doesn't completely fix the issue you can still notice the jump if you're looking for it, but this anmiation made the jump somewhat less obvious.
override func viewWillAppear() {
super.viewWillAppear()
self.view.subviews.first?.alphaValue = 0
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(300)) {
self.view.subviews.first?.animator().alphaValue = 1
}
}
override func viewWillDisappear() {
super.viewWillDisappear()
self.view.subviews.first?.animator().alphaValue = 0
}
Just want to echo that I'm also having this issue as of 2021-02-17. This is also the same as #59.
I think you can make a workaround:
func fixFirstTimeLanuchOddAnimationByImplicitlyShowIt() {
preferencesWindowController.show(preferencePane: .general)
preferencesWindowController.show(preferencePane: .advanced)
preferencesWindowController.show(preferencePane: .accounts)
preferencesWindowController.close()
}
then call it in applicationDidFinishLaunching
@gaozhanting Nice, this works! Any idea why it works?
Because the odd animation only happens the first time you opened the tab which you integrate it with SwiftUI view. With this way, it already done immediately after app lanuched, only that user can't see it again afterward.
When animating to a preference pane that has not been loaded before and has a larger width than the current pane the view is not correctly laid out initially, which causes an odd animation. The animation is correct in subsequent switches.
The example below is the example app with the width = 450 constraint removed from the Advanced tab, and the app set to open to the Advanced tab.
I'm trying to figure out the exact scenarios that causes this. Starting on Accounts does not cause this same animation to happen so I'm not sure how the size change and animations are linked.