diff options
Diffstat (limited to 'iosApp/iosApp/Map/MapWrapperView.swift')
-rw-r--r-- | iosApp/iosApp/Map/MapWrapperView.swift | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/iosApp/iosApp/Map/MapWrapperView.swift b/iosApp/iosApp/Map/MapWrapperView.swift index e9133eb..0dfb823 100644 --- a/iosApp/iosApp/Map/MapWrapperView.swift +++ b/iosApp/iosApp/Map/MapWrapperView.swift @@ -45,27 +45,23 @@ struct MapWrapperView: View { // MARK: - Controls VStack { - Group { - Button { - print ("Zoom in!") - link.zoomIn() - } label: { - Image(systemName: "plus") - .imageScale(.large) - } - - Button { - print("Zoom out!") - link.zoomOut() - } label: { - Image(systemName: "minus") - .imageScale(.large) - } + // MARK: Zoom in + Button { + print ("Zoom in!") + link.zoomIn() + } label: { + Image(systemName: "plus").imageScale(.large) } - .frame(width: 50, height: 50) - .foregroundColor(.primary) - .background(.systemBackground) - .clipShape(Circle()) + .buttonStyle(ControlButtonStyle()) + + // MARK: Zoom out + Button { + print("Zoom out!") + link.zoomOut() + } label: { + Image(systemName: "minus").imageScale(.large) + } + .buttonStyle(ControlButtonStyle()) } .frame(maxWidth: .infinity, maxHeight: .infinity, @@ -74,3 +70,13 @@ struct MapWrapperView: View { } } } + +struct ControlButtonStyle: ButtonStyle { + func makeBody(configuration: Configuration) -> some View { + configuration.label + .frame(width: 50, height: 50) + .foregroundColor(configuration.isPressed ? .secondary : .primary) + .background(configuration.isPressed ? .secondarySystemBackground : .systemBackground) + .clipShape(Circle()) + } +} |