diff --git a/panels/dock/taskmanager/package/AppItem.qml b/panels/dock/taskmanager/package/AppItem.qml index e2bb2fd49..f34613ba6 100644 --- a/panels/dock/taskmanager/package/AppItem.qml +++ b/panels/dock/taskmanager/package/AppItem.qml @@ -79,15 +79,61 @@ Item { Control { anchors.fill: parent id: appItem - implicitWidth: root.titleActive ? (iconContainer.width + titleLoader.width + root.appTitleSpacing) : iconContainer.width + implicitWidth: root.titleActive ? (iconContainer.width + titleLoader.width + root.appTitleSpacing) : iconContainer.width + root.appTitleSpacing visible: !root.Drag.active // When in dragging, hide app item - + background: AppletItemBackground { + id: hoverBackground + + readonly property int verticalSpacing: Math.round(root.iconSize / 8) + 1 + readonly property int horizontalSpacing: Math.round(root.iconSize / 8) + readonly property int nonSplitHeight: root.iconSize + verticalSpacing * 2 + readonly property int hoverPadding: Math.round((Panel.rootObject.dockItemMaxSize * 0.8 - root.iconSize) / 2) + readonly property int splitWidth: Math.round(icon.width + titleLoader.width + hoverPadding * 2) + readonly property int nonSplitWidth: Math.round(root.iconSize + horizontalSpacing * 2) + + enabled: false + + width: root.titleActive ? splitWidth : nonSplitWidth + height: nonSplitHeight + radius: height / 5 + anchors.centerIn: parent + isActive: root.active + opacity: (hoverHandler.hovered || (root.active && root.windows.length > 0)) ? 1.0 : 0.0 + Behavior on opacity { + NumberAnimation { duration: 150 } + } + } Item { id: iconContainer - anchors.verticalCenter: root.useColumnLayout ? undefined : parent.verticalCenter - anchors.horizontalCenter: root.useColumnLayout ? parent.horizontalCenter : undefined - width: root.titleActive ? root.iconSize : Panel.rootObject.dockItemMaxSize * 0.8 + width: root.iconSize height: parent.height + anchors.verticalCenter: parent.verticalCenter + states: [ + State { + name: "titleActive" + when: root.titleActive + + AnchorChanges { + target: iconContainer + anchors.left: parent.left + anchors.horizontalCenter: undefined + } + PropertyChanges { + target: iconContainer + anchors.leftMargin: hoverBackground.horizontalSpacing + } + }, + State { + name: "nonTitleActive" + when: !root.titleActive + + AnchorChanges { + target: iconContainer + anchors.horizontalCenter: parent.horizontalCenter + anchors.left: undefined + } + } + ] StatusIndicator { id: statusIndicator palette: itemPalette @@ -171,26 +217,26 @@ Item { switch(Panel.position) { case Dock.Top: { windowIndicator.anchors.horizontalCenter = iconContainer.horizontalCenter - windowIndicator.anchors.top = parent.top - windowIndicator.anchors.topMargin = Qt.binding(() => {return Math.max((root.height - iconSize) / 2 - 8, (root.height - iconSize) / 2 / 3)}) + windowIndicator.anchors.top = hoverBackground.top + windowIndicator.anchors.topMargin = 1 return } case Dock.Bottom: { windowIndicator.anchors.horizontalCenter = iconContainer.horizontalCenter - windowIndicator.anchors.bottom = parent.bottom - windowIndicator.anchors.bottomMargin = Qt.binding(() => {return Math.max((root.height - iconSize) / 2 - 8, (root.height - iconSize) / 2 / 3)}) + windowIndicator.anchors.bottom = hoverBackground.bottom + windowIndicator.anchors.bottomMargin = 1 return } case Dock.Left: { windowIndicator.anchors.verticalCenter = parent.verticalCenter - windowIndicator.anchors.left = parent.left - windowIndicator.anchors.leftMargin = Qt.binding(() => {return Math.max((root.width - iconSize) / 2 - 8, (root.width - iconSize) / 2 / 3)}) + windowIndicator.anchors.left = hoverBackground.left + windowIndicator.anchors.leftMargin = 1 return } case Dock.Right:{ windowIndicator.anchors.verticalCenter = parent.verticalCenter - windowIndicator.anchors.right = parent.right - windowIndicator.anchors.rightMargin = Qt.binding(() => {return Math.max((root.width - iconSize) / 2 - 8, (root.width - iconSize) / 2 / 3)}) + windowIndicator.anchors.right = hoverBackground.right + windowIndicator.anchors.rightMargin = 1 return } } diff --git a/panels/dock/taskmanager/package/TaskManager.qml b/panels/dock/taskmanager/package/TaskManager.qml index 698c5c168..3360995cb 100644 --- a/panels/dock/taskmanager/package/TaskManager.qml +++ b/panels/dock/taskmanager/package/TaskManager.qml @@ -16,12 +16,9 @@ ContainmentItem { property int dockOrder: 16 property real remainingSpacesForTaskManager: Panel.itemAlignment === Dock.LeftAlignment ? Panel.rootObject.dockLeftSpaceForCenter : Panel.rootObject.dockRemainingSpaceForCenter - readonly property int appItemIconSize: Math.round(Panel.rootObject.dockItemMaxSize * 9 / 14) - readonly property int appItemCellWidth: Math.round(Panel.rootObject.dockItemMaxSize * 0.8) - readonly property int appItemSpacing: Math.max(0, Math.max(10, Math.round(appItemIconSize / 3)) - Math.max(0, appItemCellWidth - appItemIconSize)) - readonly property int appTitleSpacing: Math.max(10, appItemIconSize / 3) + readonly property int appTitleSpacing: Math.max(10, Math.round(Panel.rootObject.dockItemMaxSize * 9 / 14) / 3) property real remainingSpacesForSplitWindow: Panel.rootObject.dockLeftSpaceForCenter - ( - (Panel.rootObject.dockCenterPartCount - 1) * (visualModel.cellWidth + appContainer.spacing) + (Panel.rootObject.dockCenterPartCount) * Panel.rootObject.dockPartSpacing) + (Panel.rootObject.dockCenterPartCount - 1) * (visualModel.cellWidth + appTitleSpacing) + (Panel.rootObject.dockCenterPartCount) * Panel.rootObject.dockPartSpacing) // 用于居中计算的实际应用区域尺寸 property int appContainerWidth: useColumnLayout ? Panel.rootObject.dockSize : appContainer.implicitWidth property int appContainerHeight: useColumnLayout ? appContainer.implicitHeight : Panel.rootObject.dockSize @@ -77,7 +74,7 @@ ContainmentItem { id: appContainer anchors.fill: parent useColumnLayout: taskmanager.useColumnLayout - spacing: taskmanager.appItemSpacing + spacing: 0 remove: Transition { NumberAnimation { properties: "scale,opacity"