From 3eb9122b9fd02ad55beab38371e2f971edaa89dc Mon Sep 17 00:00:00 2001 From: Hariharan Mudaliar Date: Wed, 26 Nov 2025 16:08:34 +0530 Subject: [PATCH] BugFix: Corners in borders for panels --- .../components/Clipboard/ClipboardPanel.swift | 11 +++++++++++ .../components/ColorPicker/ColorPickerPanel.swift | 11 +++++++++++ .../components/ScreenAssistant/ChatPanels.swift | 12 ++++++++++++ .../ScreenAssistant/ModelSelectionPanel.swift | 11 +++++++++++ 4 files changed, 45 insertions(+) diff --git a/DynamicIsland/components/Clipboard/ClipboardPanel.swift b/DynamicIsland/components/Clipboard/ClipboardPanel.swift index b79f6ba..3952fb7 100644 --- a/DynamicIsland/components/Clipboard/ClipboardPanel.swift +++ b/DynamicIsland/components/Clipboard/ClipboardPanel.swift @@ -8,6 +8,16 @@ import AppKit import SwiftUI +private func applyClipboardCornerMask(_ view: NSView, radius: CGFloat) { + view.wantsLayer = true + view.layer?.masksToBounds = true + view.layer?.cornerRadius = radius + view.layer?.backgroundColor = NSColor.clear.cgColor + if #available(macOS 13.0, *) { + view.layer?.cornerCurve = .continuous + } +} + class ClipboardPanel: NSPanel { init() { @@ -63,6 +73,7 @@ class ClipboardPanel: NSPanel { } let hostingView = NSHostingView(rootView: contentView) + applyClipboardCornerMask(hostingView, radius: 12) self.contentView = hostingView // Set initial size diff --git a/DynamicIsland/components/ColorPicker/ColorPickerPanel.swift b/DynamicIsland/components/ColorPicker/ColorPickerPanel.swift index 1f2d609..305c2a5 100644 --- a/DynamicIsland/components/ColorPicker/ColorPickerPanel.swift +++ b/DynamicIsland/components/ColorPicker/ColorPickerPanel.swift @@ -9,6 +9,16 @@ import SwiftUI import Cocoa import Defaults +private func applyColorPickerCornerMask(_ view: NSView, radius: CGFloat) { + view.wantsLayer = true + view.layer?.masksToBounds = true + view.layer?.cornerRadius = radius + view.layer?.backgroundColor = NSColor.clear.cgColor + if #available(macOS 13.0, *) { + view.layer?.cornerCurve = .continuous + } +} + class ColorPickerPanelManager: ObservableObject { static let shared = ColorPickerPanelManager() @@ -103,6 +113,7 @@ class ColorPickerPanel: NSPanel { } let hostingView = NSHostingView(rootView: panelView) + applyColorPickerCornerMask(hostingView, radius: 12) contentView = hostingView // Set initial size diff --git a/DynamicIsland/components/ScreenAssistant/ChatPanels.swift b/DynamicIsland/components/ScreenAssistant/ChatPanels.swift index 41dffde..f8115cb 100644 --- a/DynamicIsland/components/ScreenAssistant/ChatPanels.swift +++ b/DynamicIsland/components/ScreenAssistant/ChatPanels.swift @@ -8,6 +8,16 @@ import AppKit import SwiftUI import Defaults +private func applyChatPanelCornerMask(_ view: NSView, radius: CGFloat) { + view.wantsLayer = true + view.layer?.masksToBounds = true + view.layer?.cornerRadius = radius + view.layer?.backgroundColor = NSColor.clear.cgColor + if #available(macOS 13.0, *) { + view.layer?.cornerCurve = .continuous + } +} + // MARK: - Chat Messages Panel (Left Side) class ChatMessagesPanel: NSPanel { @@ -55,6 +65,7 @@ class ChatMessagesPanel: NSPanel { private func setupContentView() { let contentView = ChatMessagesView() let hostingView = NSHostingView(rootView: contentView) + applyChatPanelCornerMask(hostingView, radius: 16) self.contentView = hostingView // Set size for chat messages panel (wider and taller) @@ -139,6 +150,7 @@ class ChatInputPanel: NSPanel { private func setupContentView() { let contentView = ChatInputView() let hostingView = NSHostingView(rootView: contentView) + applyChatPanelCornerMask(hostingView, radius: 16) self.contentView = hostingView // Set compact size for single-line input panel diff --git a/DynamicIsland/components/ScreenAssistant/ModelSelectionPanel.swift b/DynamicIsland/components/ScreenAssistant/ModelSelectionPanel.swift index 5995251..19f07df 100644 --- a/DynamicIsland/components/ScreenAssistant/ModelSelectionPanel.swift +++ b/DynamicIsland/components/ScreenAssistant/ModelSelectionPanel.swift @@ -8,6 +8,16 @@ import AppKit import SwiftUI import Defaults +private func applyModelSelectionCornerMask(_ view: NSView, radius: CGFloat) { + view.wantsLayer = true + view.layer?.masksToBounds = true + view.layer?.cornerRadius = radius + view.layer?.backgroundColor = NSColor.clear.cgColor + if #available(macOS 13.0, *) { + view.layer?.cornerCurve = .continuous + } +} + // MARK: - Model Selection Panel class ModelSelectionPanel: NSPanel { @@ -66,6 +76,7 @@ class ModelSelectionPanel: NSPanel { private func setupContentView() { let contentView = ModelSelectionView() let hostingView = NSHostingView(rootView: contentView) + applyModelSelectionCornerMask(hostingView, radius: 16) self.contentView = hostingView // Set size for model selection panel