Skip to content

Commit 104b971

Browse files
committed
moved satellite imagery icon from bottom left to navigation bar and updated the icon
1 parent 9869133 commit 104b971

File tree

2 files changed

+13
-31
lines changed

2 files changed

+13
-31
lines changed

GoInfoGame/GoInfoGame/UI/Map/MapView.swift

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,7 @@ struct MapView: View {
180180
.padding(.leading, 16)
181181
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottomLeading)
182182
Spacer()
183-
FloatingActionButtonStack(mapButtonAction: {
184-
viewModel.updateOptions(for: mapViewRef?.region.center ?? CLLocationCoordinate2D(latitude: 0.0, longitude: 0.0))
185-
viewModel.showSatellitePicker = true
186-
})
183+
FloatingActionButtonStack()
187184
}
188185
}
189186

@@ -222,6 +219,17 @@ struct MapView: View {
222219
.navigationBarItems(leading: EmptyView())
223220
.toolbar {
224221

222+
ToolbarItem(placement: .navigationBarTrailing) {
223+
Button(action: {
224+
debugPrint("satellite icon tapped")
225+
viewModel.updateOptions(for: mapViewRef?.region.center ?? CLLocationCoordinate2D(latitude: 0.0, longitude: 0.0))
226+
viewModel.showSatellitePicker = true
227+
}) {
228+
Image(systemName: "square.2.layers.3d.bottom.filled")
229+
.frame(width: 20, height: 20)
230+
.foregroundStyle(Color(red: 135/255, green: 62/255, blue: 242/255))
231+
}
232+
}
225233
ToolbarItem(placement: .navigationBarTrailing) {
226234
Button(action: {
227235
print("Settings icon tapped")

GoInfoGame/GoInfoGame/UI/Utils/FloatingActionButtonStack.swift

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import SwiftUI
99

1010
struct FloatingActionButtonStack: View {
1111

12-
var mapButtonAction: () -> ()
1312
@State private var showBottomSheet = false
1413

1514
var body: some View {
@@ -18,8 +17,6 @@ struct FloatingActionButtonStack: View {
1817
HStack {
1918
Spacer()
2019
VStack {
21-
MapSwitcherButton(action: mapButtonAction)
22-
2320
Button(action: {
2421
showBottomSheet.toggle()
2522
}) {
@@ -47,28 +44,5 @@ struct FloatingActionButtonStack: View {
4744
}
4845
}
4946
#Preview {
50-
FloatingActionButtonStack(mapButtonAction: {})
51-
}
52-
53-
struct MapSwitcherButton: View {
54-
55-
var action: () -> ()
56-
57-
var body: some View {
58-
Button(action:
59-
action
60-
) {
61-
ZStack {
62-
Circle()
63-
.fill(Color(red: 135/255, green: 62/255, blue: 242/255))
64-
.frame(width: 40, height: 40)
65-
.shadow(radius: 5)
66-
67-
Image(systemName: "map")
68-
.font(.system(size: 28))
69-
.foregroundColor(.white)
70-
}
71-
}
72-
.padding([.bottom], 15)
73-
}
47+
FloatingActionButtonStack()
7448
}

0 commit comments

Comments
 (0)