Skip to content

Commit 411216b

Browse files
committed
fix: improve task manager layout calculation
Changed dock layout calculation to use new dockRemainingSpaceForCenter property instead of dockLeftSpaceForCenter Modified implicitWidth/Height calculations in dockCenterPart to account for task manager's center dimensions Replaced Math.min with Math.max in task manager size calculations to ensure proper space allocation Added centerWidth and centerHeight properties in task manager for accurate centering calculations These changes fix layout issues where task manager was not properly utilizing available space and improve centering behavior fix: 改进任务管理器布局计算 使用新的 dockRemainingSpaceForCenter 属性替代 dockLeftSpaceForCenter 进 行停靠栏布局计算 修改 dockCenterPart 中的隐式宽度/高度计算以考虑任务管理器的居中尺寸 将任务管理器尺寸计算中的 Math.min 替换为 Math.max 以确保正确分配空间 在任务管理器中添加 centerWidth 和 centerHeight 属性以实现精确的居中计算 这些更改解决了任务管理器未正确利用可用空间的布局问题,并改进了居中行为 Pms: BUG-327583
1 parent 45e47ee commit 411216b

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

panels/dock/package/main.qml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ Window {
2222
property int dockLeftSpaceForCenter: useColumnLayout ?
2323
(Screen.height - dockLeftPart.implicitHeight - dockRightPart.implicitHeight) :
2424
(Screen.width - dockLeftPart.implicitWidth - dockRightPart.implicitWidth)
25+
property int dockRemainingSpaceForCenter: useColumnLayout ?
26+
(Screen.height / 1.8 - dockRightPart.implicitHeight) :
27+
(Screen.width / 1.8 - dockRightPart.implicitWidth)
2528
// TODO
2629
signal dockCenterPartPosChanged()
2730
signal pressedAndDragging(bool isDragging)
@@ -421,8 +424,8 @@ Window {
421424

422425
Item {
423426
id: dockCenterPart
424-
implicitWidth: centerLoader.implicitWidth
425-
implicitHeight: centerLoader.implicitHeight
427+
implicitWidth: centerLoader.implicitWidth - DS.applet("org.deepin.ds.dock.taskmanager").rootObject.implicitWidth + DS.applet("org.deepin.ds.dock.taskmanager").rootObject.centerWidth
428+
implicitHeight: centerLoader.implicitHeight - DS.applet("org.deepin.ds.dock.taskmanager").rootObject.implicitHeight + DS.applet("org.deepin.ds.dock.taskmanager").rootObject.centerHeight
426429
onXChanged: dockCenterPartPosChanged()
427430
onYChanged: dockCenterPartPosChanged()
428431
Layout.leftMargin: !useColumnLayout && Panel.itemAlignment === Dock.CenterAlignment ?

panels/dock/taskmanager/package/TaskManager.qml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ ContainmentItem {
1313
id: taskmanager
1414
property bool useColumnLayout: Panel.position % 2
1515
property int dockOrder: 16
16-
property int remainingSpacesForTaskManager: Panel.rootObject.dockLeftSpaceForCenter - Panel.rootObject.dockItemMaxSize * 1.2
16+
property int remainingSpacesForTaskManager: Panel.itemAlignment === Dock.LeftAlignment ? Panel.rootObject.dockLeftSpaceForCenter : Panel.rootObject.dockRemainingSpaceForCenter
1717
property int forceRelayoutWorkaround: 0
1818

19+
// 用于居中计算的实际应用区域尺寸
20+
property int centerWidth: useColumnLayout ? Panel.rootObject.dockSize : (appContainer.implicitWidth + forceRelayoutWorkaround)
21+
property int centerHeight: useColumnLayout ? (appContainer.implicitHeight + forceRelayoutWorkaround) : Panel.rootObject.dockSize
22+
1923
Timer {
2024
// FIXME: dockItemMaxSize(visualModel.cellWidth,actually its implicitWidth/Height) change will cause all delegate item's position change, but
2125
// the newly added item will using the old cellWidth to calculate its position, thus it will be placed in the wrong position. Also it
@@ -30,8 +34,8 @@ ContainmentItem {
3034
}
3135
}
3236

33-
implicitWidth: useColumnLayout ? Panel.rootObject.dockSize : (Math.min(remainingSpacesForTaskManager, appContainer.implicitWidth) + forceRelayoutWorkaround)
34-
implicitHeight: useColumnLayout ? (Math.min(remainingSpacesForTaskManager, appContainer.implicitHeight) + forceRelayoutWorkaround) : Panel.rootObject.dockSize
37+
implicitWidth: useColumnLayout ? Panel.rootObject.dockSize : (Math.max(remainingSpacesForTaskManager, appContainer.implicitWidth) + forceRelayoutWorkaround)
38+
implicitHeight: useColumnLayout ? (Math.max(remainingSpacesForTaskManager, appContainer.implicitHeight) + forceRelayoutWorkaround) : Panel.rootObject.dockSize
3539

3640
// Helper function to find the current index of an app by its appId in the visualModel
3741
function findAppIndex(appId) {

0 commit comments

Comments
 (0)