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 SwiftUI
|
||||||
import Defaults
|
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
|
@MainActor
|
||||||
final class LocalSendDevicePickerWindowManager {
|
final class LocalSendDevicePickerWindowManager {
|
||||||
static let shared = LocalSendDevicePickerWindowManager()
|
static let shared = LocalSendDevicePickerWindowManager()
|
||||||
|
|
@ -34,6 +44,7 @@ final class LocalSendDevicePickerWindowManager {
|
||||||
onDeviceSelected: @escaping (LocalSendDeviceInfo) -> Void,
|
onDeviceSelected: @escaping (LocalSendDeviceInfo) -> Void,
|
||||||
onDismiss: @escaping () -> Void
|
onDismiss: @escaping () -> Void
|
||||||
) {
|
) {
|
||||||
|
let cornerRadius: CGFloat = 24
|
||||||
self.onDeviceSelected = onDeviceSelected
|
self.onDeviceSelected = onDeviceSelected
|
||||||
self.onDismiss = onDismiss
|
self.onDismiss = onDismiss
|
||||||
|
|
||||||
|
|
@ -50,7 +61,7 @@ final class LocalSendDevicePickerWindowManager {
|
||||||
|
|
||||||
if let existingWindow = window {
|
if let existingWindow = window {
|
||||||
let hostingView = NSHostingView(rootView: pickerView)
|
let hostingView = NSHostingView(rootView: pickerView)
|
||||||
hostingView.layer?.backgroundColor = .clear
|
applyLocalSendPanelCornerMask(hostingView, radius: cornerRadius)
|
||||||
existingWindow.contentView = hostingView
|
existingWindow.contentView = hostingView
|
||||||
existingWindow.makeKeyAndOrderFront(nil)
|
existingWindow.makeKeyAndOrderFront(nil)
|
||||||
return
|
return
|
||||||
|
|
@ -81,9 +92,7 @@ final class LocalSendDevicePickerWindowManager {
|
||||||
pickerView
|
pickerView
|
||||||
.background(Color.clear)
|
.background(Color.clear)
|
||||||
)
|
)
|
||||||
hostingView.wantsLayer = true
|
applyLocalSendPanelCornerMask(hostingView, radius: cornerRadius)
|
||||||
hostingView.layer?.backgroundColor = .clear
|
|
||||||
hostingView.layer?.isOpaque = false
|
|
||||||
newWindow.contentView = hostingView
|
newWindow.contentView = hostingView
|
||||||
newWindow.isMovableByWindowBackground = true
|
newWindow.isMovableByWindowBackground = true
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue