mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-12 03:21:09 +00:00
Fix toast view stutter
This commit is contained in:
1 parent
b16556dd1b
commit
093390084f
3 files changed
+5
-5
No files matched your search
@@ -21,7 +21,7 @@
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "QuickDrop"
|
||||
"value" : "QuickDropGitHub"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -276,7 +276,6 @@ struct QuickDropToastHostView: View {
|
||||
.opacity(isVisible ? 1 : hiddenOpacity)
|
||||
.blur(radius: isVisible ? 0 : hiddenBlur)
|
||||
.animation(animation, value: receiveModel.toastIsVisible)
|
||||
.animation(animation, value: receiveModel.toastDismissStyle)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .trailing)
|
||||
.padding(.trailing, toastTrailingPadding)
|
||||
}
|
||||
|
||||
@@ -431,7 +431,7 @@ class ReceiveModel: ObservableObject, InboundAppDelegate {
|
||||
// MARK: - macOS Progress Overlay
|
||||
|
||||
#if os(macOS)
|
||||
private func scheduleToastReveal(for window: NSWindow, delay: TimeInterval = 0.1) {
|
||||
private func scheduleToastReveal(for window: NSWindow) {
|
||||
toastRevealTask?.cancel()
|
||||
toastRevealTask = nil
|
||||
|
||||
@@ -443,7 +443,8 @@ class ReceiveModel: ObservableObject, InboundAppDelegate {
|
||||
}
|
||||
|
||||
toastRevealTask = revealTask
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + delay, execute: revealTask)
|
||||
// Reveal on the next run-loop tick to avoid pop-in without timer jitter.
|
||||
DispatchQueue.main.async(execute: revealTask)
|
||||
}
|
||||
|
||||
func showQuickDropToast(for connectionID: String) {
|
||||
@@ -461,10 +462,10 @@ class ReceiveModel: ObservableObject, InboundAppDelegate {
|
||||
toastRevealTask = nil
|
||||
|
||||
if let window = toastWindow {
|
||||
window.makeKeyAndOrderFront(nil)
|
||||
toastDismissStyle = .slide
|
||||
|
||||
if !toastIsVisible {
|
||||
window.makeKeyAndOrderFront(nil)
|
||||
scheduleToastReveal(for: window)
|
||||
}
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user