From 7ecd3133809bce5ba69f12056659d7b09f99fafa Mon Sep 17 00:00:00 2001 From: Mengci Cai Date: Sat, 31 Jan 2026 10:34:44 +0800 Subject: [PATCH] fix: Optimize the entrance animation logic for notification bubbles 1. Modified the bubble addition transition logic in panels/notification/bubble/package/main.qml. 2. Updated the logic to only handle the previous bubble at index count - 2. 3. Improved pre-animation processing performance, reducing complexity from O(N) to O(1). 4. Ensured that when a new bubble appears, only the position of the immediately preceding bubble needs to be fixed to meet layout requirements. Log: Fixed overlapping animations when multiple notifications arrive rapidly. Influence: 1. Send multiple notifications in quick succession to test the queuing mechanism. 2. Verify that bubble animations play sequentially without overlapping. 3. Ensure existing bubbles move smoothly when new ones are added. 4. Verify correct behavior when the number of bubbles exceeds the maximum limit. pms: BUG-320719 --- panels/notification/bubble/package/main.qml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/panels/notification/bubble/package/main.qml b/panels/notification/bubble/package/main.qml index 5baad807e..b538af501 100644 --- a/panels/notification/bubble/package/main.qml +++ b/panels/notification/bubble/package/main.qml @@ -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 + } + } + } + } + XAnimator { + target: addTrans.ViewTransition.item + from: addTrans.ViewTransition.item.width + to: 0 + duration: 600 + easing.type: Easing.OutExpo + } } delegate: Bubble { width: 360