]> git.r.bdr.sh - rbdr/map/blob - Map/Presentation/Commands/MapCommands.swift
Update syntax
[rbdr/map] / Map / Presentation / Commands / MapCommands.swift
1 import SwiftUI
2
3 struct MapCommands: Commands {
4
5 @AppStorage("viewStyle") var viewStyle: ViewStyle = .horizontal
6 @AppStorage("zoom") var zoom = 1.0
7
8 var body: some Commands {
9
10 // View
11
12 CommandGroup(after: CommandGroupPlacement.toolbar) {
13 if viewStyle == .horizontal {
14 Button("Use Vertical Layout") {
15 viewStyle = .vertical
16 }.keyboardShortcut(
17 "l", modifiers: EventModifiers([.command])
18 )
19 } else {
20 Button("Use Horizontal Layout") {
21 viewStyle = .horizontal
22 }.keyboardShortcut(
23 "l", modifiers: EventModifiers([.command])
24 )
25 }
26 Divider()
27 Button("Zoom In") {
28 zoom = min(Constants.kMaxZoom, zoom + 0.1)
29 }.keyboardShortcut(
30 "+", modifiers: EventModifiers([.command])
31 )
32 Button("Zoom Out") {
33 zoom = max(Constants.kMinZoom, zoom - 0.1)
34 }.keyboardShortcut(
35 "-", modifiers: EventModifiers([.command])
36 )
37 Divider()
38 }
39
40 CommandGroup(replacing: CommandGroupPlacement.help) {
41 Button("Map Help") { NSWorkspace.shared.open(URL(string: "https://map.tranquil.systems")!) }
42 }
43 }
44 }