forked from shadowfacts/Tusker
Fix focused attachment view being incorrect size on iPad
This commit is contained in:
parent
99b74559da
commit
f68d1009e5
|
@ -16,7 +16,6 @@ class AttachmentThumbnailController: ViewController {
|
|||
@Published private var image: UIImage?
|
||||
@Published private var gifController: GIFController?
|
||||
@Published private var fullSize: Bool = false
|
||||
@Published private var imageBackground: Color?
|
||||
|
||||
init(attachment: DraftAttachment) {
|
||||
self.attachment = attachment
|
||||
|
|
|
@ -110,10 +110,11 @@ class MatchedGeometryViewController<Content: View>: UIViewController, UIViewCont
|
|||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
func matchedView(id: AnyHashable, source: () -> AnyView) -> some View {
|
||||
let frame = state.currentFrames[id]!
|
||||
let dest = state.destinations[id]!.0
|
||||
return ZStack {
|
||||
if let frame = state.currentFrames[id],
|
||||
let dest = state.destinations[id]?.0 {
|
||||
ZStack {
|
||||
source()
|
||||
dest
|
||||
.opacity(state.mode == .presenting ? (state.animating ? 1 : 0) : (state.animating ? 0 : 1))
|
||||
|
@ -124,6 +125,7 @@ class MatchedGeometryViewController<Content: View>: UIViewController, UIViewCont
|
|||
.animation(.interpolatingSpring(mass: Double(mass), stiffness: Double(state.mode == .presenting ? presentStiffness : dismissStiffness), damping: Double(state.mode == .presenting ? presentDamping : dismissDamping), initialVelocity: 0), value: frame)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: UIViewControllerTransitioningDelegate
|
||||
func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
|
||||
|
@ -150,6 +152,8 @@ class MatchedGeometryPresentationAnimationController<Content: View>: NSObject, U
|
|||
let container = transitionContext.containerView
|
||||
|
||||
// add the VC to the container, which kicks off layout out the content hosting controller
|
||||
matchedGeomVC.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
||||
matchedGeomVC.view.frame = container.bounds
|
||||
container.addSubview(matchedGeomVC.view)
|
||||
|
||||
// layout out the content hosting controller and having enough destinations may take a while
|
||||
|
|
Loading…
Reference in New Issue