| | |
| | | badge.masksToBounds = true |
| | | |
| | | let selectedIndicator = CALayer() |
| | | selectedIndicator.cornerRadius = 2 |
| | | selectedIndicator.backgroundColor = (item.appGroupIndex == selectedAppGroupIndex |
| | | ? NSColor.controlAccentColor |
| | | : NSColor.clear |
| | | ).cgColor |
| | | selectedIndicator.isHidden = true |
| | | |
| | | container.addSublayer(background) |
| | | container.addSublayer(icon) |
| | | container.addSublayer(label) |
| | | container.addSublayer(badge) |
| | | container.addSublayer(selectedIndicator) |
| | | appShelfContentLayer.addSublayer(container) |
| | | |
| | | return AppShelfItemLayers( |
| | |
| | | : NSColor.controlAccentColor.withAlphaComponent(0.90) |
| | | ).cgColor |
| | | item.badgeLayer.frame = CGRect( |
| | | x: iconX + visualIconSize - badgeWidth + 3, |
| | | y: iconY + visualIconSize - 14, |
| | | x: iconX - 3, |
| | | y: iconY - 2, |
| | | width: badgeWidth, |
| | | height: 16 |
| | | ) |
| | | item.selectedIndicatorLayer.frame = CGRect( |
| | | x: bounds.midX - 8, |
| | | y: 0, |
| | | width: 16, |
| | | height: 4 |
| | | ) |
| | | item.selectedIndicatorLayer.backgroundColor = (isSelected |
| | | ? NSColor.controlAccentColor |
| | | : NSColor.clear |
| | | ).cgColor |
| | | item.selectedIndicatorLayer.frame = .zero |
| | | item.selectedIndicatorLayer.backgroundColor = NSColor.clear.cgColor |
| | | } |
| | | |
| | | private func appShelfRows() -> [[AppShelfItemLayers]] { |