// // KMButtonLayer.swift // PDF Reader Pro // // Created by tangchao on 2023/11/21. // import Cocoa enum KMNoteFilerButtonLayerType: Int { case none = 0 case dot } class KMButtonLayer: CALayer { var layerType: KMNoteFilerButtonLayerType = .none { didSet { if (self.layerType == .dot) { self.backgroundColor = KMAppearance.Layout.l_1Color().cgColor self.cornerRadius = 6 } else { self.backgroundColor = KMAppearance.Layout.l_1Color().cgColor self.cornerRadius = 6 } } } override func draw(in ctx: CGContext) { if (self.layerType == .dot) { KMContextAddEllipseInRect(ctx, CGRectMake(14, 2, 8, 8)) KMContextSetRGBFillColor(ctx, 34/255.0, 122/255.0, 255/255.0, 1.0) KMContextDrawPath(ctx, .fill); } else { } } }