mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-01-12 09:58:38 +00:00
fix currency widget updating
This commit is contained in:
parent
d46827832e
commit
55177a7f90
@ -11,7 +11,7 @@ import Cocoa
|
|||||||
class CustomButtonTouchBarItem: NSCustomTouchBarItem, NSGestureRecognizerDelegate {
|
class CustomButtonTouchBarItem: NSCustomTouchBarItem, NSGestureRecognizerDelegate {
|
||||||
private let tapClosure: (() -> ())?
|
private let tapClosure: (() -> ())?
|
||||||
private let longTapClosure: (() -> ())?
|
private let longTapClosure: (() -> ())?
|
||||||
private(set) var button: NSButton!
|
private(set) var button: NSButton! //todo hide completely
|
||||||
|
|
||||||
private var singleClick: NSClickGestureRecognizer!
|
private var singleClick: NSClickGestureRecognizer!
|
||||||
private var longClick: NSPressGestureRecognizer!
|
private var longClick: NSPressGestureRecognizer!
|
||||||
|
|||||||
@ -109,9 +109,9 @@ class CurrencyBarItem: CustomButtonTouchBarItem {
|
|||||||
|
|
||||||
let title = String(format: "%@%.2f", self.prefix, value)
|
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])
|
let newTitle = NSMutableAttributedString(string: title as String, attributes: [.foregroundColor: color, .font: regularFont])
|
||||||
newTitle.setAlignment(.center, range: NSRange(location: 0, length: title.count))
|
newTitle.setAlignment(.center, range: NSRange(location: 0, length: title.count))
|
||||||
button.attributedTitle = newTitle
|
self.attributedTitle = newTitle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user