Skip to content

Commit 21226d7

Browse files
52cybdeepin-bot[bot]
authored andcommitted
fix(dock): fix premature icon label compression in taskbar
Use iconSize instead of maxSize to calculate other items' occupied space, and remove overly aggressive implicit size constraints that shrink task items before the taskbar is actually full. 使用图标尺寸而非最大尺寸计算其他项占用空间,移除过度限制 隐式大小的约束,避免任务栏未满时就开始压缩图标标签。 Log: 修复任务栏未满时图标标签被过早压缩的问题 PMS: 358915 Influence: 1.打开多个应用时,任务栏要占满时再开始挤压应用标签;2.相邻应用标签的文案和背景不重叠;3.应用程序过多时,应用图标会溢出任务栏中间区域,后期考虑溢出处理方案。
1 parent 18ef378 commit 21226d7

3 files changed

Lines changed: 6 additions & 22 deletions

File tree

panels/dock/package/main.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Window {
2727

2828
let otherOccupied = 0;
2929
if (otherCount > 0) {
30-
otherOccupied = otherCount * dockItemMaxSize + otherCount * spacing;
30+
otherOccupied = otherCount * dockItemIconSize + otherCount * spacing;
3131
}
3232

3333
if (useColumnLayout) {

panels/dock/taskmanager/package/AppItem.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Item {
3838
Drag.mimeData: { "text/x-dde-dock-dnd-appid": itemId, "text/x-dde-dock-dnd-source": "taskbar", "text/x-dde-dock-dnd-winid": windows.length > 0 ? windows[0] : ""}
3939

4040
property bool useColumnLayout: Panel.rootObject.useColumnLayout
41-
property int iconSize: Panel.rootObject.dockItemMaxSize * 9 / 14
41+
property real iconSize: Panel.rootObject.dockItemMaxSize * 9 / 14
4242
property bool enableTitle: false
4343
property bool titleActive: enableTitle && titleLoader.active
4444
property var iconGlobalPoint: {

panels/dock/taskmanager/package/TaskManager.qml

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ ContainmentItem {
6262
dataModel: taskmanager.Applet.dataModel
6363
iconSize: Panel.rootObject.dockItemMaxSize * 9 / 14
6464
spacing: appContainer.spacing
65-
cellSize: visualModel.cellWidth
66-
itemPadding: taskmanager.appTitleSpacing
65+
cellSize: textCalculator.iconSize
66+
itemPadding: Math.round(textCalculator.iconSize / 8)
6767
remainingSpace: taskmanager.remainingSpacesForTaskManager
6868
font.family: D.DTK.fontManager.t6.family
6969
font.pixelSize: Math.max(10, Math.min(20, Math.round(textCalculator.iconSize * 0.35)))
@@ -132,24 +132,8 @@ ContainmentItem {
132132
Behavior on opacity { NumberAnimation { duration: 200 } }
133133
Behavior on scale { NumberAnimation { duration: 200 } }
134134

135-
implicitWidth: {
136-
let targetW = useColumnLayout ? taskmanager.implicitWidth : appItem.implicitWidth;
137-
if (useColumnLayout || visualModel.count <= 0) return targetW;
138-
139-
let totalSpacing = Math.max(0, visualModel.count - 1) * taskmanager.appTitleSpacing;
140-
let availableW = taskmanager.remainingSpacesForTaskManager - totalSpacing;
141-
let maxW = availableW / visualModel.count;
142-
return Math.min(targetW, Math.max(1, maxW));
143-
}
144-
implicitHeight: {
145-
let targetH = useColumnLayout ? visualModel.cellWidth : taskmanager.implicitHeight;
146-
if (!useColumnLayout || visualModel.count <= 0) return targetH;
147-
148-
let totalSpacing = Math.max(0, visualModel.count - 1) * taskmanager.appTitleSpacing;
149-
let availableH = taskmanager.remainingSpacesForTaskManager - totalSpacing;
150-
let maxH = availableH / visualModel.count;
151-
return Math.min(targetH, Math.max(1, maxH));
152-
}
135+
implicitWidth: useColumnLayout ? taskmanager.implicitWidth : appItem.implicitWidth
136+
implicitHeight: useColumnLayout ? visualModel.cellWidth : taskmanager.implicitHeight
153137

154138
property int visualIndex: DelegateModel.itemsIndex
155139
property var modelIndex: visualModel.modelIndex(index)

0 commit comments

Comments
 (0)