Fix gallery content being incorrectly positioned on macOS when reduce motion is on

See #446
This commit is contained in:
Shadowfacts 2024-04-02 21:01:54 -04:00
parent 46b455c3d1
commit 69ee3bb4f0
2 changed files with 7 additions and 1 deletions

View File

@ -52,6 +52,9 @@ class GalleryDismissAnimationController: NSObject, UIViewControllerAnimatedTrans
appliedSourceToDestTransform = false appliedSourceToDestTransform = false
} }
to.view.frame = container.bounds
from.view.frame = container.bounds
let content = itemViewController.takeContent() let content = itemViewController.takeContent()
content.view.translatesAutoresizingMaskIntoConstraints = true content.view.translatesAutoresizingMaskIntoConstraints = true
content.view.layer.masksToBounds = true content.view.layer.masksToBounds = true
@ -112,6 +115,8 @@ class GalleryDismissAnimationController: NSObject, UIViewControllerAnimatedTrans
return return
} }
toVC.view.frame = transitionContext.containerView.bounds
fromVC.view.frame = transitionContext.containerView.bounds
transitionContext.containerView.addSubview(toVC.view) transitionContext.containerView.addSubview(toVC.view)
transitionContext.containerView.addSubview(fromVC.view) transitionContext.containerView.addSubview(fromVC.view)

View File

@ -121,8 +121,9 @@ class GalleryPresentationAnimationController: NSObject, UIViewControllerAnimated
return return
} }
transitionContext.containerView.addSubview(to.view)
to.view.alpha = 0 to.view.alpha = 0
to.view.frame = transitionContext.containerView.bounds
transitionContext.containerView.addSubview(to.view)
let duration = transitionDuration(using: transitionContext) let duration = transitionDuration(using: transitionContext)
let animator = UIViewPropertyAnimator(duration: duration, curve: .easeInOut) let animator = UIViewPropertyAnimator(duration: duration, curve: .easeInOut)