Skip to content

Commit

Permalink
Extract avatar size in snapshot view
Browse files Browse the repository at this point in the history
  • Loading branch information
nuno-vieira committed Jan 8, 2025
1 parent 2e48e69 commit 091ff9e
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class LocationAttachmentSnapshotView: _View, ThemeProvider {
let mapHeightRatio: CGFloat = 0.7
let mapOptions: MKMapSnapshotter.Options = .init()

let avatarSize: CGFloat = 30

static var snapshotsCache: NSCache<NSString, UIImage> = .init()
var snapshotter: MKMapSnapshotter?

Expand Down Expand Up @@ -77,7 +79,7 @@ class LocationAttachmentSnapshotView: _View, ThemeProvider {
view.translatesAutoresizingMaskIntoConstraints = false
view.shouldShowOnlineIndicator = false
view.layer.masksToBounds = true
view.layer.cornerRadius = 15
view.layer.cornerRadius = avatarSize / 2
view.layer.borderWidth = 2
view.layer.borderColor = UIColor.white.cgColor
view.isHidden = true
Expand Down Expand Up @@ -135,8 +137,8 @@ class LocationAttachmentSnapshotView: _View, ThemeProvider {
imageView.heightAnchor.constraint(equalTo: imageView.widthAnchor, multiplier: mapHeightRatio),
avatarView.centerXAnchor.constraint(equalTo: imageView.centerXAnchor),
avatarView.centerYAnchor.constraint(equalTo: imageView.centerYAnchor),
avatarView.widthAnchor.constraint(equalToConstant: 30),
avatarView.heightAnchor.constraint(equalToConstant: 30)
avatarView.widthAnchor.constraint(equalToConstant: avatarSize),
avatarView.heightAnchor.constraint(equalToConstant: avatarSize)
])
}

Expand Down

0 comments on commit 091ff9e

Please sign in to comment.