Fix MapLibreStaticMapView referesh (#1481)

This commit is contained in:
Alfonso Grillo
2023-08-11 14:31:56 +02:00
committed by GitHub
parent 25f66d2557
commit f413a6b01a
2 changed files with 9 additions and 4 deletions
@@ -27,7 +27,7 @@ struct LocationRoomTimelineView: View {
descriptionView
.frame(maxWidth: mapAspectRatio * mapMaxHeight, alignment: .leading)
MapLibreStaticMapView(geoURI: geoURI) {
MapLibreStaticMapView(geoURI: geoURI, mapSize: .init(width: mapAspectRatio * mapMaxHeight, height: mapMaxHeight)) {
LocationMarkerView()
}
.frame(maxHeight: mapMaxHeight)
@@ -56,12 +56,13 @@ struct LocationRoomTimelineView: View {
}
private extension MapLibreStaticMapView {
init(geoURI: GeoURI, @ViewBuilder pinAnnotationView: () -> PinAnnotation) {
init(geoURI: GeoURI, mapSize: CGSize, @ViewBuilder pinAnnotationView: () -> PinAnnotation) {
self.init(coordinates: .init(latitude: geoURI.latitude, longitude: geoURI.longitude),
zoomLevel: 15,
attributionPlacement: .bottomLeft,
mapTilerStatic: MapTilerStaticMap(baseURL: ServiceLocator.shared.settings.mapTilerBaseURL,
key: ServiceLocator.shared.settings.mapTilerApiKey),
mapSize: mapSize,
pinAnnotationView: pinAnnotationView)
}
}