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,18 +110,20 @@ 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 {
|
||||
source()
|
||||
dest
|
||||
.opacity(state.mode == .presenting ? (state.animating ? 1 : 0) : (state.animating ? 0 : 1))
|
||||
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))
|
||||
}
|
||||
.frame(width: frame.width, height: frame.height)
|
||||
.position(x: frame.midX, y: frame.midY)
|
||||
.ignoresSafeArea()
|
||||
.animation(.interpolatingSpring(mass: Double(mass), stiffness: Double(state.mode == .presenting ? presentStiffness : dismissStiffness), damping: Double(state.mode == .presenting ? presentDamping : dismissDamping), initialVelocity: 0), value: frame)
|
||||
}
|
||||
.frame(width: frame.width, height: frame.height)
|
||||
.position(x: frame.midX, y: frame.midY)
|
||||
.ignoresSafeArea()
|
||||
.animation(.interpolatingSpring(mass: Double(mass), stiffness: Double(state.mode == .presenting ? presentStiffness : dismissStiffness), damping: Double(state.mode == .presenting ? presentDamping : dismissDamping), initialVelocity: 0), value: frame)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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