wip
This commit is contained in:
parent
c3679c9a2a
commit
dfa048e918
|
@ -5,22 +5,18 @@ import SwiftUI
|
||||||
|
|
||||||
struct AttachmentLocationPickerView: View {
|
struct AttachmentLocationPickerView: View {
|
||||||
@State var region = MKCoordinateRegion()
|
@State var region = MKCoordinateRegion()
|
||||||
@State var userTrackingMode: MapUserTrackingMode = .follow
|
@State var userInteracting = false
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ZStack {
|
ZStack {
|
||||||
|
if userInteracting {
|
||||||
Map(
|
Map(
|
||||||
coordinateRegion: $region,
|
coordinateRegion: $region,
|
||||||
interactionModes: .all,
|
interactionModes: .all,
|
||||||
showsUserLocation: false,
|
showsUserLocation: false,
|
||||||
userTrackingMode: $userTrackingMode
|
userTrackingMode: .constant(.none)
|
||||||
)
|
)
|
||||||
.overlay {
|
.overlay {
|
||||||
Image(systemName: "mappin")
|
|
||||||
.resizable()
|
|
||||||
.frame(width: 30, height: 30)
|
|
||||||
.foregroundColor(.Material.Elements.active)
|
|
||||||
if userTrackingMode != .follow {
|
|
||||||
VStack {
|
VStack {
|
||||||
Spacer()
|
Spacer()
|
||||||
HStack {
|
HStack {
|
||||||
|
@ -31,12 +27,25 @@ struct AttachmentLocationPickerView: View {
|
||||||
.foregroundColor(.Material.Elements.active)
|
.foregroundColor(.Material.Elements.active)
|
||||||
.padding()
|
.padding()
|
||||||
.tappablePadding(.symmetric(10)) {
|
.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