mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-21 22:05:59 +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 {
|
var body: some View {
|
||||||
Group {
|
Group {
|
||||||
if #available(macOS 26.0, *) {
|
if #available(macOS 26.0, *) {
|
||||||
Color.clear
|
GlassEffectBackgroundView(cornerRadius: cornerRadius)
|
||||||
.glassEffect(.regular, in: .rect(cornerRadius: cornerRadius, style: .continuous))
|
|
||||||
} else {
|
} else {
|
||||||
VisualEffectView(material: .hudWindow, blendingMode: .behindWindow, cornerRadius: cornerRadius)
|
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
|
// NSVisualEffectView wrapper for macOS 11 compatible blur/vibrancy
|
||||||
struct VisualEffectView: NSViewRepresentable {
|
struct VisualEffectView: NSViewRepresentable {
|
||||||
var material: NSVisualEffectView.Material = .hudWindow
|
var material: NSVisualEffectView.Material = .hudWindow
|
||||||
|
|||||||
Reference in new issue
Block a user