mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
BugFix: remove sharp corners
This commit is contained in:
parent
79f41cb69e
commit
aee19c90d6
1 changed files with 13 additions and 4 deletions
|
|
@ -20,6 +20,16 @@ import AppKit
|
|||
import SwiftUI
|
||||
import Defaults
|
||||
|
||||
private func applyLocalSendPanelCornerMask(_ 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
|
||||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
final class LocalSendDevicePickerWindowManager {
|
||||
static let shared = LocalSendDevicePickerWindowManager()
|
||||
|
|
@ -34,6 +44,7 @@ final class LocalSendDevicePickerWindowManager {
|
|||
onDeviceSelected: @escaping (LocalSendDeviceInfo) -> Void,
|
||||
onDismiss: @escaping () -> Void
|
||||
) {
|
||||
let cornerRadius: CGFloat = 24
|
||||
self.onDeviceSelected = onDeviceSelected
|
||||
self.onDismiss = onDismiss
|
||||
|
||||
|
|
@ -50,7 +61,7 @@ final class LocalSendDevicePickerWindowManager {
|
|||
|
||||
if let existingWindow = window {
|
||||
let hostingView = NSHostingView(rootView: pickerView)
|
||||
hostingView.layer?.backgroundColor = .clear
|
||||
applyLocalSendPanelCornerMask(hostingView, radius: cornerRadius)
|
||||
existingWindow.contentView = hostingView
|
||||
existingWindow.makeKeyAndOrderFront(nil)
|
||||
return
|
||||
|
|
@ -81,9 +92,7 @@ final class LocalSendDevicePickerWindowManager {
|
|||
pickerView
|
||||
.background(Color.clear)
|
||||
)
|
||||
hostingView.wantsLayer = true
|
||||
hostingView.layer?.backgroundColor = .clear
|
||||
hostingView.layer?.isOpaque = false
|
||||
applyLocalSendPanelCornerMask(hostingView, radius: cornerRadius)
|
||||
newWindow.contentView = hostingView
|
||||
newWindow.isMovableByWindowBackground = true
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue