Skip to content

Commit 4126a20

Browse files
author
Achyut Kumar M
committed
change rect from visible to location for initial launch
1 parent 2542510 commit 4126a20

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

GoInfoGame/GoInfoGame/UI/Map/CustomMap.swift

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ struct CustomMap: UIViewRepresentable {
5151
// Hide points of interest except street names
5252
mapView.pointOfInterestFilter = .excludingAll
5353
mapView.register(CustomAnnotationView.self, forAnnotationViewWithReuseIdentifier: CustomAnnotationView.reuseIdentifier)
54-
55-
let currentAltitude = mapView.camera.altitude
56-
54+
5755
if useBingMaps {
5856
let tileOverlay = BingTileOverlay()
5957
tileOverlay.minimumZ = 3 // Set minimum zoom level
@@ -184,13 +182,20 @@ struct CustomMap: UIViewRepresentable {
184182

185183
func mapViewDidFinishRenderingMap(_ mapView: MKMapView, fullyRendered: Bool) {
186184
guard fullyRendered else { return }
187-
185+
186+
let userCoordinate = mapView.userLocation.coordinate
187+
guard CLLocationCoordinate2DIsValid(userCoordinate) else { return }
188+
189+
let region = MKCoordinateRegion(center: userCoordinate, latitudinalMeters: 1000, longitudinalMeters: 1000)
190+
let userLocationRect = MKMapRect(region)
191+
188192
if shadowOverlay.visibleRects.isEmpty {
189-
shadowOverlay.addVisibleRect(mapView.visibleMapRect)
193+
shadowOverlay.addVisibleRect(userLocationRect)
190194
mapView.removeOverlay(shadowOverlay)
191195
mapView.addOverlay(shadowOverlay)
192196
}
193197
}
198+
194199

195200
//renders polyline
196201
func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {

0 commit comments

Comments
 (0)