|
|
@@ -144,13 +144,15 @@ final class SidebarNavItem: NSControl {
|
|
|
// MARK: - Action Button
|
|
|
|
|
|
final class PillButton: NSButton {
|
|
|
+ private let horizontalPadding: CGFloat = 16
|
|
|
+
|
|
|
init(title: String, color: NSColor) {
|
|
|
super.init(frame: .zero)
|
|
|
self.title = title
|
|
|
isBordered = false
|
|
|
wantsLayer = true
|
|
|
layer?.backgroundColor = color.cgColor
|
|
|
- layer?.cornerRadius = 10
|
|
|
+ layer?.cornerRadius = 11
|
|
|
font = AppTheme.semiboldFont(size: 13)
|
|
|
contentTintColor = .white
|
|
|
|
|
|
@@ -161,12 +163,25 @@ final class PillButton: NSButton {
|
|
|
imageHugsTitle = true
|
|
|
}
|
|
|
|
|
|
- heightAnchor.constraint(equalToConstant: 36).isActive = true
|
|
|
+ heightAnchor.constraint(equalToConstant: 40).isActive = true
|
|
|
}
|
|
|
|
|
|
@available(*, unavailable)
|
|
|
required init?(coder: NSCoder) { nil }
|
|
|
|
|
|
+ override var intrinsicContentSize: NSSize {
|
|
|
+ var size = super.intrinsicContentSize
|
|
|
+ size.width += horizontalPadding * 2
|
|
|
+ return size
|
|
|
+ }
|
|
|
+
|
|
|
+ override func draw(_ dirtyRect: NSRect) {
|
|
|
+ let originalBounds = bounds
|
|
|
+ defer { bounds = originalBounds }
|
|
|
+ bounds = originalBounds.insetBy(dx: horizontalPadding, dy: 0)
|
|
|
+ super.draw(dirtyRect)
|
|
|
+ }
|
|
|
+
|
|
|
override func resetCursorRects() {
|
|
|
addCursorRect(bounds, cursor: .pointingHand)
|
|
|
}
|