From 6a00a6f47715e8be2f441212f882e55762770aa4 Mon Sep 17 00:00:00 2001 From: wjyrich Date: Mon, 2 Mar 2026 16:51:14 +0800 Subject: [PATCH] fix: prevent animation glitch during task text width changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Fixed animation glitch that occurred when task item text width changed dynamically 2. Added onOptimalSingleTextWidthChanged handler to temporarily disable and re-enable animations 3. Created displacedTransition ID for proper animation reference 4. Used Qt.callLater to ensure smooth transition restoration Log: Fixed taskbar animation glitches when application names change width Influence: 1. Test taskbar behavior when application names change (e.g., language switching) 2. Verify smooth animations when dragging task items 3. Check that text width changes don't cause visual artifacts 4. Test with applications that have varying name lengths 5. Verify task grouping and overflow functionality remains intact fix: 修复任务文本宽度变化时的动画故障 1. 修复了任务项文本宽度动态变化时出现的动画故障 2. 添加了onOptimalSingleTextWidthChanged处理程序,临时禁用并重新启用动画 3. 创建了displacedTransition ID以便正确引用动画 4. 使用Qt.callLater确保平滑恢复过渡效果 Log: 修复了应用程序名称宽度变化时的任务栏动画故障 Influence: 1. 测试应用程序名称变化时的任务栏行为(如语言切换) 2. 验证拖动任务项时的平滑动画效果 3. 检查文本宽度变化不会导致视觉伪影 4. 测试具有不同名称长度的应用程序 5. 验证任务分组和溢出功能保持正常 目前需要修复:拆分后,remove的时候动画显示需要进行修复,目前由于卡图标重叠以及图标间距卡顿问题,主要由于X,Y动画卡主引起,从而去除里相应的remove和add的displace的动画。 --- panels/dock/OverflowContainer.qml | 5 +- .../dock/taskmanager/package/TaskManager.qml | 52 +++++++++++++++++-- 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/panels/dock/OverflowContainer.qml b/panels/dock/OverflowContainer.qml index 8fdd03732..0c04b2889 100644 --- a/panels/dock/OverflowContainer.qml +++ b/panels/dock/OverflowContainer.qml @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2023-2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -16,6 +16,9 @@ Item { property alias remove: listView.remove property alias move: listView.move property alias displaced: listView.displaced + property alias addDisplaced: listView.addDisplaced + property alias removeDisplaced: listView.removeDisplaced + property alias moveDisplaced: listView.moveDisplaced ListView { id: listView anchors.fill: parent diff --git a/panels/dock/taskmanager/package/TaskManager.qml b/panels/dock/taskmanager/package/TaskManager.qml index 3360995cb..82740dfea 100644 --- a/panels/dock/taskmanager/package/TaskManager.qml +++ b/panels/dock/taskmanager/package/TaskManager.qml @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2023-2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -68,6 +68,14 @@ ContainmentItem { remainingSpace: taskmanager.remainingSpacesForSplitWindow font.family: D.DTK.fontManager.t6.family font.pixelSize: Math.max(10, Math.min(20, Math.round(textCalculator.iconSize * 0.35))) + onOptimalSingleTextWidthChanged: { + appContainer.addDisplaced = null + appContainer.removeDisplaced = null + Qt.callLater(function() { + appContainer.addDisplaced = addDisplacedTransition + appContainer.removeDisplaced = removeDisplacedTransition + }) + } } OverflowContainer { @@ -83,7 +91,7 @@ ContainmentItem { duration: 200 } } - displaced: Transition { + moveDisplaced: Transition { NumberAnimation { properties: "x,y" easing.type: Easing.OutQuad @@ -99,7 +107,45 @@ ContainmentItem { duration: 200 } } - move: displaced + addDisplaced: Transition { + id: addDisplacedTransition + NumberAnimation { + properties: "x,y" + easing.type: Easing.OutQuad + } + NumberAnimation { + properties: "scale" + from: 0 + to: 1 + duration: 200 + } + NumberAnimation { + properties: "opacity" + from: 0 + to: 1 + duration: 200 + } + } + removeDisplaced: Transition { + id: removeDisplacedTransition + NumberAnimation { + properties: "x,y" + easing.type: Easing.OutQuad + } + NumberAnimation { + properties: "scale" + from: 0 + to: 1 + duration: 200 + } + NumberAnimation { + properties: "opacity" + from: 0 + to: 1 + duration: 200 + } + } + move: moveDisplaced model: DelegateModel { id: visualModel model: taskmanager.Applet.dataModel