mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-11 02:51:11 +00:00
Fix toast view liquid glass not updating background
This commit is contained in:
1 parent
fcbe99dd85
commit
02ab04c69e
1 file changed
+17
-2
@@ -439,8 +439,7 @@ struct AdaptiveToastBackgroundLayer: View {
|
||||
var body: some View {
|
||||
Group {
|
||||
if #available(macOS 26.0, *) {
|
||||
Color.clear
|
||||
.glassEffect(.regular, in: .rect(cornerRadius: cornerRadius, style: .continuous))
|
||||
GlassEffectBackgroundView(cornerRadius: cornerRadius)
|
||||
} else {
|
||||
VisualEffectView(material: .hudWindow, blendingMode: .behindWindow, cornerRadius: cornerRadius)
|
||||
}
|
||||
@@ -449,6 +448,22 @@ struct AdaptiveToastBackgroundLayer: View {
|
||||
}
|
||||
|
||||
|
||||
@available(macOS 26.0, *)
|
||||
struct GlassEffectBackgroundView: NSViewRepresentable {
|
||||
var cornerRadius: CGFloat = 0
|
||||
|
||||
func makeNSView(context: Context) -> NSGlassEffectView {
|
||||
let v = NSGlassEffectView()
|
||||
v.cornerRadius = cornerRadius
|
||||
return v
|
||||
}
|
||||
|
||||
func updateNSView(_ v: NSGlassEffectView, context: Context) {
|
||||
v.cornerRadius = cornerRadius
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// NSVisualEffectView wrapper for macOS 11 compatible blur/vibrancy
|
||||
struct VisualEffectView: NSViewRepresentable {
|
||||
var material: NSVisualEffectView.Material = .hudWindow
|
||||
|
||||
Reference in new issue
Block a user