|
|
@@ -144,13 +144,15 @@ final class SidebarNavItem: NSControl {
|
|
144
|
144
|
// MARK: - Action Button
|
|
145
|
145
|
|
|
146
|
146
|
final class PillButton: NSButton {
|
|
|
147
|
+ private let horizontalPadding: CGFloat = 16
|
|
|
148
|
+
|
|
147
|
149
|
init(title: String, color: NSColor) {
|
|
148
|
150
|
super.init(frame: .zero)
|
|
149
|
151
|
self.title = title
|
|
150
|
152
|
isBordered = false
|
|
151
|
153
|
wantsLayer = true
|
|
152
|
154
|
layer?.backgroundColor = color.cgColor
|
|
153
|
|
- layer?.cornerRadius = 10
|
|
|
155
|
+ layer?.cornerRadius = 11
|
|
154
|
156
|
font = AppTheme.semiboldFont(size: 13)
|
|
155
|
157
|
contentTintColor = .white
|
|
156
|
158
|
|
|
|
@@ -161,12 +163,25 @@ final class PillButton: NSButton {
|
|
161
|
163
|
imageHugsTitle = true
|
|
162
|
164
|
}
|
|
163
|
165
|
|
|
164
|
|
- heightAnchor.constraint(equalToConstant: 36).isActive = true
|
|
|
166
|
+ heightAnchor.constraint(equalToConstant: 40).isActive = true
|
|
165
|
167
|
}
|
|
166
|
168
|
|
|
167
|
169
|
@available(*, unavailable)
|
|
168
|
170
|
required init?(coder: NSCoder) { nil }
|
|
169
|
171
|
|
|
|
172
|
+ override var intrinsicContentSize: NSSize {
|
|
|
173
|
+ var size = super.intrinsicContentSize
|
|
|
174
|
+ size.width += horizontalPadding * 2
|
|
|
175
|
+ return size
|
|
|
176
|
+ }
|
|
|
177
|
+
|
|
|
178
|
+ override func draw(_ dirtyRect: NSRect) {
|
|
|
179
|
+ let originalBounds = bounds
|
|
|
180
|
+ defer { bounds = originalBounds }
|
|
|
181
|
+ bounds = originalBounds.insetBy(dx: horizontalPadding, dy: 0)
|
|
|
182
|
+ super.draw(dirtyRect)
|
|
|
183
|
+ }
|
|
|
184
|
+
|
|
170
|
185
|
override func resetCursorRects() {
|
|
171
|
186
|
addCursorRect(bounds, cursor: .pointingHand)
|
|
172
|
187
|
}
|