mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-10-31 10:28:36 +00:00
fix currency widget updating
This commit is contained in:
@@ -11,7 +11,7 @@ import Cocoa
|
||||
class CustomButtonTouchBarItem: NSCustomTouchBarItem, NSGestureRecognizerDelegate {
|
||||
private let tapClosure: (() -> ())?
|
||||
private let longTapClosure: (() -> ())?
|
||||
private(set) var button: NSButton!
|
||||
private(set) var button: NSButton! //todo hide completely
|
||||
|
||||
private var singleClick: NSClickGestureRecognizer!
|
||||
private var longClick: NSPressGestureRecognizer!
|
||||
|
||||
@@ -109,9 +109,9 @@ class CurrencyBarItem: CustomButtonTouchBarItem {
|
||||
|
||||
let title = String(format: "%@%.2f", self.prefix, value)
|
||||
|
||||
let regularFont = button.attributedTitle.attribute(.font, at: 0, effectiveRange: nil) as? NSFont ?? NSFont.systemFont(ofSize: 15)
|
||||
let regularFont = self.attributedTitle.attribute(.font, at: 0, effectiveRange: nil) as? NSFont ?? NSFont.systemFont(ofSize: 15)
|
||||
let newTitle = NSMutableAttributedString(string: title as String, attributes: [.foregroundColor: color, .font: regularFont])
|
||||
newTitle.setAlignment(.center, range: NSRange(location: 0, length: title.count))
|
||||
button.attributedTitle = newTitle
|
||||
self.attributedTitle = newTitle
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user