mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
BugFix: Corners in borders for panels
This commit is contained in:
parent
18f68f56ea
commit
3eb9122b9f
4 changed files with 45 additions and 0 deletions
|
|
@ -8,6 +8,16 @@
|
||||||
import AppKit
|
import AppKit
|
||||||
import SwiftUI
|
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 {
|
class ClipboardPanel: NSPanel {
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
|
@ -63,6 +73,7 @@ class ClipboardPanel: NSPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
let hostingView = NSHostingView(rootView: contentView)
|
let hostingView = NSHostingView(rootView: contentView)
|
||||||
|
applyClipboardCornerMask(hostingView, radius: 12)
|
||||||
self.contentView = hostingView
|
self.contentView = hostingView
|
||||||
|
|
||||||
// Set initial size
|
// Set initial size
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,16 @@ import SwiftUI
|
||||||
import Cocoa
|
import Cocoa
|
||||||
import Defaults
|
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 {
|
class ColorPickerPanelManager: ObservableObject {
|
||||||
static let shared = ColorPickerPanelManager()
|
static let shared = ColorPickerPanelManager()
|
||||||
|
|
||||||
|
|
@ -103,6 +113,7 @@ class ColorPickerPanel: NSPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
let hostingView = NSHostingView(rootView: panelView)
|
let hostingView = NSHostingView(rootView: panelView)
|
||||||
|
applyColorPickerCornerMask(hostingView, radius: 12)
|
||||||
contentView = hostingView
|
contentView = hostingView
|
||||||
|
|
||||||
// Set initial size
|
// Set initial size
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,16 @@ import AppKit
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import Defaults
|
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)
|
// MARK: - Chat Messages Panel (Left Side)
|
||||||
class ChatMessagesPanel: NSPanel {
|
class ChatMessagesPanel: NSPanel {
|
||||||
|
|
||||||
|
|
@ -55,6 +65,7 @@ class ChatMessagesPanel: NSPanel {
|
||||||
private func setupContentView() {
|
private func setupContentView() {
|
||||||
let contentView = ChatMessagesView()
|
let contentView = ChatMessagesView()
|
||||||
let hostingView = NSHostingView(rootView: contentView)
|
let hostingView = NSHostingView(rootView: contentView)
|
||||||
|
applyChatPanelCornerMask(hostingView, radius: 16)
|
||||||
self.contentView = hostingView
|
self.contentView = hostingView
|
||||||
|
|
||||||
// Set size for chat messages panel (wider and taller)
|
// Set size for chat messages panel (wider and taller)
|
||||||
|
|
@ -139,6 +150,7 @@ class ChatInputPanel: NSPanel {
|
||||||
private func setupContentView() {
|
private func setupContentView() {
|
||||||
let contentView = ChatInputView()
|
let contentView = ChatInputView()
|
||||||
let hostingView = NSHostingView(rootView: contentView)
|
let hostingView = NSHostingView(rootView: contentView)
|
||||||
|
applyChatPanelCornerMask(hostingView, radius: 16)
|
||||||
self.contentView = hostingView
|
self.contentView = hostingView
|
||||||
|
|
||||||
// Set compact size for single-line input panel
|
// Set compact size for single-line input panel
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,16 @@ import AppKit
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import Defaults
|
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
|
// MARK: - Model Selection Panel
|
||||||
class ModelSelectionPanel: NSPanel {
|
class ModelSelectionPanel: NSPanel {
|
||||||
|
|
||||||
|
|
@ -66,6 +76,7 @@ class ModelSelectionPanel: NSPanel {
|
||||||
private func setupContentView() {
|
private func setupContentView() {
|
||||||
let contentView = ModelSelectionView()
|
let contentView = ModelSelectionView()
|
||||||
let hostingView = NSHostingView(rootView: contentView)
|
let hostingView = NSHostingView(rootView: contentView)
|
||||||
|
applyModelSelectionCornerMask(hostingView, radius: 16)
|
||||||
self.contentView = hostingView
|
self.contentView = hostingView
|
||||||
|
|
||||||
// Set size for model selection panel
|
// Set size for model selection panel
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue