BugFix: Corner radius

This commit is contained in:
Hariharan Mudaliar 2025-10-28 00:05:38 +05:30
commit bb308458b5

View file

@ -18,6 +18,8 @@ class LockScreenPanelManager {
private var panelWindow: NSWindow? private var panelWindow: NSWindow?
private var hasDelegated = false private var hasDelegated = false
private var collapsedFrame: NSRect? private var collapsedFrame: NSRect?
private let collapsedPanelCornerRadius: CGFloat = 28
private let expandedPanelCornerRadius: CGFloat = 52
private init() { private init() {
print("[\(timestamp())] LockScreenPanelManager: initialized") print("[\(timestamp())] LockScreenPanelManager: initialized")
@ -77,7 +79,16 @@ class LockScreenPanelManager {
} }
window.setFrame(targetFrame, display: true) window.setFrame(targetFrame, display: true)
window.contentView = NSHostingView(rootView: LockScreenMusicPanel()) let hosting = NSHostingView(rootView: LockScreenMusicPanel())
hosting.frame = NSRect(origin: .zero, size: targetFrame.size)
window.contentView = hosting
// Ensure the underlying window content is clipped to rounded corners
if let content = window.contentView {
content.wantsLayer = true
content.layer?.masksToBounds = true
content.layer?.cornerRadius = collapsedPanelCornerRadius
}
if !hasDelegated { if !hasDelegated {
SkyLightOperator.shared.delegateWindow(window) SkyLightOperator.shared.delegateWindow(window)
@ -111,6 +122,17 @@ class LockScreenPanelManager {
} else { } else {
window.setFrame(targetFrame, display: true) window.setFrame(targetFrame, display: true)
} }
// Update corner radius to match the SwiftUI panel's style
let targetRadius = expanded ? expandedPanelCornerRadius : collapsedPanelCornerRadius
if animated {
CATransaction.begin()
CATransaction.setAnimationDuration(0.28)
window.contentView?.layer?.cornerRadius = targetRadius
CATransaction.commit()
} else {
window.contentView?.layer?.cornerRadius = targetRadius
}
} }
func hidePanel() { func hidePanel() {