-
Notifications
You must be signed in to change notification settings - Fork 58
fix: add queue for bubble insertion animations #1420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -70,7 +70,26 @@ Window { | |||||||||||||||||||||||||||||||||||||||
| verticalLayoutDirection: ListView.BottomToTop | ||||||||||||||||||||||||||||||||||||||||
| add: Transition { | ||||||||||||||||||||||||||||||||||||||||
| id: addTrans | ||||||||||||||||||||||||||||||||||||||||
| XAnimator { target: addTrans.ViewTransition.item; from: addTrans.ViewTransition.item.width; duration: 600; easing.type: Easing.OutExpo } | ||||||||||||||||||||||||||||||||||||||||
| // Before starting the new animation, forcibly complete the previous notification bubble's animation | ||||||||||||||||||||||||||||||||||||||||
| ScriptAction { | ||||||||||||||||||||||||||||||||||||||||
| script: { | ||||||||||||||||||||||||||||||||||||||||
| // Only handle the previous notification bubble (at index count - 1); no need to iterate through all of them | ||||||||||||||||||||||||||||||||||||||||
| if (bubbleView.count > 1) { | ||||||||||||||||||||||||||||||||||||||||
| let prevItem = bubbleView.itemAtIndex(bubbleView.count - 2) | ||||||||||||||||||||||||||||||||||||||||
| if (prevItem) { | ||||||||||||||||||||||||||||||||||||||||
| // Directly set x to 0 to forcibly complete the animation | ||||||||||||||||||||||||||||||||||||||||
| prevItem.x = 0 | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+78
to
+82
|
||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| XAnimator { | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+76
to
+86
|
||||||||||||||||||||||||||||||||||||||||
| // Only handle the previous notification bubble (at index count - 1); no need to iterate through all of them | |
| if (bubbleView.count > 1) { | |
| let prevItem = bubbleView.itemAtIndex(bubbleView.count - 2) | |
| if (prevItem) { | |
| // Directly set x to 0 to forcibly complete the animation | |
| prevItem.x = 0 | |
| } | |
| } | |
| } | |
| } | |
| XAnimator { | |
| // If a previous add animation is still running, complete it cleanly | |
| if (addXAnimator.running) { | |
| addXAnimator.complete(); | |
| } | |
| } | |
| } | |
| XAnimator { | |
| id: addXAnimator |
Copilot
AI
Jan 31, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The explicit to: 0 parameter was added to the XAnimator, which is good for clarity. However, according to the PR description, XAnimator should be replaced with NumberAnimation (as seen in panels/notification/center/NotifyView.qml:127). NumberAnimation provides better control for synchronization and allows the animation to be properly interrupted or completed, which is essential for the queue mechanism mentioned in the PR description.
Copilot
AI
Jan 31, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description states "Replace XAnimator with NumberAnimation in QML for better control" but the code still uses XAnimator. This is a discrepancy between the PR description and the implementation. If NumberAnimation is needed for better control, the XAnimator should be replaced as described.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment states "at index count - 1" but the code actually accesses "bubbleView.count - 2". The comment is misleading because when a new item is being added in the add transition, bubbleView.count has already been incremented to include the new item. So count - 2 is indeed the previous bubble (the one that was last before this addition), not count - 1. The comment should be corrected to say "at index count - 2" or better yet, explain that since count includes the newly added item, count - 2 gives us the previously added bubble.