Improve gallery presentation/dismissal animation layering

This commit is contained in:
Shadowfacts 2024-03-31 15:55:35 -04:00
parent 2386f545e2
commit abf0568398
4 changed files with 9 additions and 2 deletions

View File

@ -57,7 +57,6 @@ class AttachmentsContainerView: UIView {
private func commonInit() {
self.isUserInteractionEnabled = true
self.layer.cornerRadius = 5
self.layer.masksToBounds = true
createBlurView()
createHideButton()

View File

@ -66,8 +66,9 @@ class ProfileHeaderView: UIView {
backgroundColor = .appBackground
avatarContainerView.backgroundColor = .appBackground
avatarContainerView.layer.masksToBounds = true
avatarContainerView.layer.cornerCurve = .continuous
// Set zPositions so the gallery presentation/dismissal animation looks correct.
avatarContainerView.layer.zPosition = 2
avatarImageView.layer.masksToBounds = true
avatarImageView.layer.cornerCurve = .continuous
avatarImageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(avatarPressed)))
@ -75,6 +76,7 @@ class ProfileHeaderView: UIView {
headerImageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(headerPressed)))
headerImageView.isUserInteractionEnabled = true
headerImageView.layer.zPosition = 1
var config = UIButton.Configuration.plain()
config.image = UIImage(systemName: "ellipsis")
@ -83,9 +85,11 @@ class ProfileHeaderView: UIView {
moreButton.addInteraction(UIPointerInteraction(delegate: self))
moreButton.showsMenuAsPrimaryAction = true
moreButton.isContextMenuInteractionEnabled = true
moreButton.layer.zPosition = 2
followButton.setNeedsUpdateConfiguration()
followButton.addInteraction(UIPointerInteraction(delegate: self))
followButton.layer.zPosition = 2
displayNameLabel.font = UIFontMetrics(forTextStyle: .title1).scaledFont(for: .systemFont(ofSize: 24, weight: .semibold))
displayNameLabel.adjustsFontForContentSizeCategory = true

View File

@ -131,6 +131,8 @@ class ConversationMainStatusCollectionViewCell: UICollectionViewListCell, Status
pollView,
] as! [any StatusContentView], useTopSpacer: true).configure {
$0.setContentHuggingPriority(.defaultLow, for: .vertical)
// So that during gallery presentation/dismissal animations, the attachment view appears over everything else.
$0.layer.zPosition = 1
}
let contentTextView = StatusContentTextView().configure {

View File

@ -84,6 +84,8 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
metaIndicatorsView.trailingAnchor.constraint(equalTo: avatarImageView.trailingAnchor),
metaIndicatorsTopConstraint,
])
// So that during gallery presentation/dismissal animations, the attachment view appears over everything else.
$0.layer.zPosition = 1
}
private static let avatarImageViewSize: CGFloat = 50