Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect animation for first transition to preference pane with different width #60

Closed
JosephDuffy opened this issue Aug 23, 2020 · 6 comments · Fixed by #100
Closed

Comments

@JosephDuffy
Copy link

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.

Screen Recording 2020-08-23 at 19 39 33 2020-08-23 19_49_52

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.

@mohakapt
Copy link

I'm having exactly the same issue here. Only with me it's happening with different heights.

@mohakapt
Copy link

mohakapt commented Jan 1, 2021

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
  }

@hisaac
Copy link

hisaac commented Feb 17, 2021

Just want to echo that I'm also having this issue as of 2021-02-17. This is also the same as #59.

@gaozhanting
Copy link

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

@hisaac
Copy link

hisaac commented Jul 25, 2021

@gaozhanting Nice, this works! Any idea why it works?

@gaozhanting
Copy link

gaozhanting commented Jul 25, 2021

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.

dezinezync pushed a commit to dezinezync/Preferences that referenced this issue Dec 17, 2022
dezinezync pushed a commit to dezinezync/Preferences that referenced this issue Dec 17, 2022
metacodes added a commit to metacodes/Settings that referenced this issue May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants