Skip to content

Commit

Permalink
Merge remote-tracking branch 'tisfeng/dev' into add_setting_icon_to_s…
Browse files Browse the repository at this point in the history
…hortcuts

# Conflicts:
#	Easydict/Feature/Configuration/Configuration.swift
  • Loading branch information
NeverAgain11 committed Mar 5, 2024
2 parents 738c278 + e420597 commit c95d8c9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 5 additions & 4 deletions Easydict/Feature/Configuration/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,6 @@ class Configuration: NSObject {

var cancellables: [AnyCancellable] = []

var fontSizeRatio: CGFloat {
fontSizes[Int(fontSizeIndex)]
}

var automaticallyChecksForUpdates: Bool {
get {
updater.automaticallyChecksForUpdates
Expand All @@ -149,6 +145,11 @@ class Configuration: NSObject {
}
}

var fontSizeRatio: CGFloat {
let safeIndex = max(0, min(Int(fontSizeIndex), fontSizes.count - 1))
return fontSizes[safeIndex]
}

static func destroySharedInstance() {
shared = Configuration()
}
Expand Down
8 changes: 6 additions & 2 deletions Easydict/NewApp/Feature/Shortcut/Shortcut+Bind.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,16 @@ extension Shortcut {

@objc
func increaseFontSize() {
Configuration.shared.fontSizeIndex += 1
if Configuration.shared.fontSizeIndex < Configuration.shared.fontSizes.count - 1 {
Configuration.shared.fontSizeIndex += 1
}
}

@objc
func decreaseFontSize() {
Configuration.shared.fontSizeIndex -= 1
if Configuration.shared.fontSizeIndex > 0 {
Configuration.shared.fontSizeIndex -= 1
}
}

@objc
Expand Down

0 comments on commit c95d8c9

Please sign in to comment.