PCB // Enable round panel corners.

This commit is contained in:
ShikiSuen 2024-04-06 15:48:44 +08:00
parent 67a6bb5f87
commit 08a54c14c1
1 changed files with 15 additions and 4 deletions

View File

@ -39,7 +39,10 @@ public class PopupCompositionBuffer: NSWindowController {
} else {
self.accent = themeColorCocoa
}
window?.backgroundColor = adjustedThemeColor
let themeColor = adjustedThemeColor
window?.backgroundColor = .clear
window?.contentView?.layer?.backgroundColor = themeColor.cgColor
window?.contentView?.layer?.borderColor = NSColor.white.withAlphaComponent(0.1).cgColor
messageTextField.backgroundColor = .clear
messageTextField.textColor = textColor
}
@ -72,9 +75,8 @@ public class PopupCompositionBuffer: NSWindowController {
)
panel.level = NSWindow.Level(Int(max(CGShieldingWindowLevel(), kCGPopUpMenuWindowLevel)) + 1)
panel.hasShadow = true
panel.backgroundColor = NSColor.controlBackgroundColor
panel.styleMask = .utilityWindow
panel.isMovable = false
panel.backgroundColor = .clear
panel.isOpaque = false
messageTextField = NSTextField()
messageTextField.isEditable = false
messageTextField.isSelectable = false
@ -85,6 +87,15 @@ public class PopupCompositionBuffer: NSWindowController {
messageTextField.font = .systemFont(ofSize: 18) //
panel.contentView?.addSubview(messageTextField)
panel.contentView?.wantsLayer = true
panel.contentView?.shadow = .init()
panel.contentView?.shadow?.shadowBlurRadius = 6
panel.contentView?.shadow?.shadowColor = .black
panel.contentView?.shadow?.shadowOffset = .zero
if let layer = panel.contentView?.layer {
layer.cornerRadius = 9
layer.borderWidth = 1
layer.masksToBounds = true
}
Self.currentWindow = panel
super.init(window: panel)
}