diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-01-31 03:38:12 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-01-31 03:38:12 -0600 |
commit | 72a1d714a539a93a90e864cd725f9b0944068183 (patch) | |
tree | 3f368a2f5bdfadbd71c10e45e6d8098d1047207c /iosApp/iosApp/Map/MapWrapperView.swift | |
parent | acc5c4ca3c30fbcaaf79a0ea92ef63c651be2ed6 (diff) | |
download | etbsa-trackermap-mobile-72a1d714a539a93a90e864cd725f9b0944068183.tar.gz etbsa-trackermap-mobile-72a1d714a539a93a90e864cd725f9b0944068183.tar.bz2 etbsa-trackermap-mobile-72a1d714a539a93a90e864cd725f9b0944068183.zip |
Fixed initial zoom, improved map controls and map refactoring
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()) + } +} |