@@ -22,17 +22,18 @@ class LocationSnapshotManager {
2222
2323 private var internalPicture : UIImage = UIImage ( )
2424
25+ let settings = Settings . shared
26+
2527 private enum Factors {
26- static let regionScale : CGFloat = 10.0
2728 static let pinScale : CGFloat = 0.5
2829 static let pinWidthMultiplier : CGFloat = 0.25
2930 }
3031
3132 func createImageFrom( _ location: CLLocationCoordinate2D , in size: CGFloat , execute: @escaping ( ) -> Void ) {
3233 let options = MKMapSnapshotter . Options ( )
33- let region = MKCoordinateRegion ( center : location ,
34- latitudinalMeters: CLLocationDistance ( size * Factors . regionScale ) ,
35- longitudinalMeters : CLLocationDistance ( size * Factors . regionScale ) )
34+ let radius = CLLocationDistance ( settings . intialZoomLevel )
35+ let region = MKCoordinateRegion ( center : location , latitudinalMeters: radius , longitudinalMeters : radius )
36+
3637 options. region = region
3738 options. size = CGSize ( width: size, height: size)
3839
@@ -61,6 +62,7 @@ class LocationSnapshotManager {
6162
6263 private func drawMKPinAnnotation( for point: CGPoint ) {
6364 let pinView = MKPinAnnotationView ( )
65+
6466 let pinImage = pinView. image? . resize ( scale: Factors . pinScale)
6567 guard let width = pinImage? . size. width,
6668 let height = pinImage? . size. height else { return }
0 commit comments