diff --git a/ConversationsClassic/View/Screens/Attachments/AttachmentLocationPickerView.swift b/ConversationsClassic/View/Screens/Attachments/AttachmentLocationPickerView.swift index 49c3f7d..b714789 100644 --- a/ConversationsClassic/View/Screens/Attachments/AttachmentLocationPickerView.swift +++ b/ConversationsClassic/View/Screens/Attachments/AttachmentLocationPickerView.swift @@ -5,22 +5,18 @@ import SwiftUI struct AttachmentLocationPickerView: View { @State var region = MKCoordinateRegion() - @State var userTrackingMode: MapUserTrackingMode = .follow + @State var userInteracting = false var body: some View { ZStack { - Map( - coordinateRegion: $region, - interactionModes: .all, - showsUserLocation: false, - userTrackingMode: $userTrackingMode - ) - .overlay { - Image(systemName: "mappin") - .resizable() - .frame(width: 30, height: 30) - .foregroundColor(.Material.Elements.active) - if userTrackingMode != .follow { + if userInteracting { + Map( + coordinateRegion: $region, + interactionModes: .all, + showsUserLocation: false, + userTrackingMode: .constant(.none) + ) + .overlay { VStack { Spacer() HStack { @@ -31,12 +27,25 @@ struct AttachmentLocationPickerView: View { .foregroundColor(.Material.Elements.active) .padding() .tappablePadding(.symmetric(10)) { - userTrackingMode = .follow + userInteracting = false } } } } + } else { + Map( + coordinateRegion: $region, + interactionModes: .all, + showsUserLocation: false, + userTrackingMode: .constant(.follow) + ) + .gesture(DragGesture().onChanged { _ in + userInteracting = true + }) } + Image(systemName: "mappin") + .font(.system(size: 30)) + .foregroundColor(.Material.Elements.active) } } }