Toast: update visibility for newest toast
This commit is contained in:
parent
f9a48becce
commit
a3aba8d0db
2 changed files with 21 additions and 9 deletions
|
|
@ -165,13 +165,21 @@ Singleton {
|
||||||
"timestamp": Date.now()
|
"timestamp": Date.now()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If there's already a toast showing, instantly start hide animation and show new one
|
||||||
|
if (isShowingToast) {
|
||||||
|
// Instantly start hide animation of current toast
|
||||||
|
for (var i = 0; i < allToasts.length; i++) {
|
||||||
|
allToasts[i].hide()
|
||||||
|
}
|
||||||
|
// Clear the queue since we're showing the new toast immediately
|
||||||
|
messageQueue = []
|
||||||
|
}
|
||||||
|
|
||||||
// Add to queue
|
// Add to queue
|
||||||
messageQueue.push(toastData)
|
messageQueue.push(toastData)
|
||||||
|
|
||||||
// Process queue if not currently showing a toast
|
// Always process immediately for instant display
|
||||||
if (!isShowingToast) {
|
processQueue()
|
||||||
processQueue()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process the message queue
|
// Process the message queue
|
||||||
|
|
@ -181,11 +189,6 @@ Singleton {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isShowingToast) {
|
|
||||||
// Wait for current toast to finish
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var toastData = messageQueue.shift()
|
var toastData = messageQueue.shift()
|
||||||
isShowingToast = true
|
isShowingToast = true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,16 @@ Item {
|
||||||
// NToast updates its scaling when showing.
|
// NToast updates its scaling when showing.
|
||||||
scaling = ScalingService.getScreenScale(screen)
|
scaling = ScalingService.getScreenScale(screen)
|
||||||
|
|
||||||
|
// Stop any running animations and reset state
|
||||||
|
showAnimation.stop()
|
||||||
|
hideAnimation.stop()
|
||||||
|
autoHideTimer.stop()
|
||||||
|
|
||||||
|
// Ensure we start from the hidden position
|
||||||
|
y = hiddenY
|
||||||
visible = true
|
visible = true
|
||||||
|
|
||||||
|
// Start the show animation
|
||||||
showAnimation.start()
|
showAnimation.start()
|
||||||
if (duration > 0 && !persistent) {
|
if (duration > 0 && !persistent) {
|
||||||
autoHideTimer.start()
|
autoHideTimer.start()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue