change order on increase/decrease in mac menu

This commit is contained in:
Satindar Dhillon 2022-07-05 07:59:06 -07:00
parent 5beb807458
commit 02bb54b813
3 changed files with 35 additions and 35 deletions

View file

@ -15,70 +15,70 @@ import Views
public var fontSizeButtons: some View {
Group {
Button(
action: {
storedFontSize = min(storedFontSize + 2, 28)
NSNotification.readerSettingsChanged()
},
label: { Text("Increase Reader Font Size") }
)
.keyboardShortcut("+")
Button(
action: {
storedFontSize = max(storedFontSize - 2, 10)
NSNotification.readerSettingsChanged()
},
label: { Text("Decrease Reader Font Size")
label: { Text("Decrease Font Size")
}
)
.keyboardShortcut("-")
Button(
action: {
storedFontSize = min(storedFontSize + 2, 28)
NSNotification.readerSettingsChanged()
},
label: { Text("Increase Font Size") }
)
.keyboardShortcut("+")
}
}
public var marginSizeButtons: some View {
Group {
Button(
action: {
storedMaxWidthPercentage = max(storedMaxWidthPercentage - 10, 40)
NSNotification.readerSettingsChanged()
},
label: { Text("Increase Reader Margin")
}
)
.keyboardShortcut("]")
Button(
action: {
storedMaxWidthPercentage = min(storedMaxWidthPercentage + 10, 100)
NSNotification.readerSettingsChanged()
},
label: { Text("Decrease Reader Margin")
label: { Text("Decrease Margin")
}
)
.keyboardShortcut("[")
Button(
action: {
storedMaxWidthPercentage = max(storedMaxWidthPercentage - 10, 40)
NSNotification.readerSettingsChanged()
},
label: { Text("Increase Margin")
}
)
.keyboardShortcut("]")
}
}
public var lineSpacingButtons: some View {
Group {
Button(
action: {
storedLineSpacing = min(storedLineSpacing + 25, 300)
NSNotification.readerSettingsChanged()
},
label: { Text("Increase Reader Line Spacing") }
)
.keyboardShortcut("l")
Button(
action: {
storedLineSpacing = max(storedLineSpacing - 25, 100)
NSNotification.readerSettingsChanged()
},
label: { Text("Decrease Reader Line Spacing") }
label: { Text("Decrease Line Spacing") }
)
.keyboardShortcut("k")
Button(
action: {
storedLineSpacing = min(storedLineSpacing + 25, 300)
NSNotification.readerSettingsChanged()
},
label: { Text("Increase Line Spacing") }
)
.keyboardShortcut("l")
}
}
@ -91,7 +91,7 @@ import Views
}
public var body: some Commands {
CommandMenu("Reader Settings") {
CommandMenu("Reader Display") {
fontSizeButtons
Divider()

View file

@ -81,8 +81,8 @@ struct WebReader: PlatformViewRepresentable {
(webView as? OmnivoreWebView)?.dispatchEvent(.saveAnnotation(annotation: annotation))
}
if readerSettingsChangedTransactionID != context.coordinator.previousReaderSettingsChangedTransactionID {
context.coordinator.previousReaderSettingsChangedTransactionID = readerSettingsChangedTransactionID
if readerSettingsChangedTransactionID != context.coordinator.previousReaderSettingsChangedUUID {
context.coordinator.previousReaderSettingsChangedUUID = readerSettingsChangedTransactionID
(webView as? OmnivoreWebView)?.updateFontFamily()
(webView as? OmnivoreWebView)?.updateFontSize()
(webView as? OmnivoreWebView)?.updateTextContrast()

View file

@ -15,7 +15,7 @@ final class WebReaderCoordinator: NSObject {
var linkHandler: (URL) -> Void = { _ in }
var needsReload = false
var lastSavedAnnotationID: UUID?
var previousReaderSettingsChangedTransactionID: UUID?
var previousReaderSettingsChangedUUID: UUID?
var previousShowNavBarActionID: UUID?
var previousShareActionID: UUID?
var updateNavBarVisibilityRatio: (Double) -> Void = { _ in }