wip
This commit is contained in:
parent
c3679c9a2a
commit
dfa048e918
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue