2 Copyright (C) 2024 Rubén Beltrán del Río
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see https://map.tranquil.systems.
19 struct MapCommands: Commands {
21 @AppStorage("viewStyle") var viewStyle: ViewStyle = .horizontal
22 @AppStorage("zoom") var zoom = 1.0
24 var body: some Commands {
28 CommandGroup(after: CommandGroupPlacement.toolbar) {
29 if viewStyle == .horizontal {
30 Button("Use Vertical Layout") {
33 "l", modifiers: EventModifiers([.command])
36 Button("Use Horizontal Layout") {
37 viewStyle = .horizontal
39 "l", modifiers: EventModifiers([.command])
44 zoom = min(Constants.kMaxZoom, zoom + 0.1)
46 "+", modifiers: EventModifiers([.command])
49 zoom = max(Constants.kMinZoom, zoom - 0.1)
51 "-", modifiers: EventModifiers([.command])
56 CommandGroup(replacing: CommandGroupPlacement.help) {
57 Button("Map Help") { NSWorkspace.shared.open(URL(string: "https://map.tranquil.systems")!) }