|
@@ -26,22 +26,40 @@ class KMToolbarZoomItemView: NSView {
|
|
|
}()
|
|
|
|
|
|
lazy var zoomInButton: NSButton = {
|
|
|
- let button = NSButton()
|
|
|
+ let button = KMCoverButton()
|
|
|
+ button.wantsLayer = true
|
|
|
+ button.layer?.cornerRadius = 4
|
|
|
button.isBordered = false
|
|
|
button.title = ""
|
|
|
button.image = NSImage(named: "KMImageNameUXIconToolbarZoominNor")
|
|
|
button.target = self
|
|
|
button.action = #selector(_buttonClicked)
|
|
|
+ button.coverAction = { cbtn, caction in
|
|
|
+ if caction == .enter {
|
|
|
+ cbtn.layer?.backgroundColor = KMToolbarItemView.selectedBackgroundColor.cgColor
|
|
|
+ } else if caction == .exit {
|
|
|
+ cbtn.layer?.backgroundColor = KMToolbarItemView.normalBackgroundColor.cgColor
|
|
|
+ }
|
|
|
+ }
|
|
|
return button
|
|
|
}()
|
|
|
|
|
|
lazy var zoomOutButton: NSButton = {
|
|
|
- let button = NSButton()
|
|
|
+ let button = KMCoverButton()
|
|
|
button.isBordered = false
|
|
|
+ button.wantsLayer = true
|
|
|
+ button.layer?.cornerRadius = 4
|
|
|
button.title = ""
|
|
|
button.image = NSImage(named: "KMImageNameUXIconToolbarZoomoutNor")
|
|
|
button.target = self
|
|
|
button.action = #selector(_buttonClicked)
|
|
|
+ button.coverAction = { cbtn, caction in
|
|
|
+ if caction == .enter {
|
|
|
+ cbtn.layer?.backgroundColor = KMToolbarItemView.selectedBackgroundColor.cgColor
|
|
|
+ } else if caction == .exit {
|
|
|
+ cbtn.layer?.backgroundColor = KMToolbarItemView.normalBackgroundColor.cgColor
|
|
|
+ }
|
|
|
+ }
|
|
|
return button
|
|
|
}()
|
|
|
|