diff --git a/panels/dock/AppletItemButton.qml b/panels/dock/AppletItemButton.qml index db2441760..0b94c3777 100644 --- a/panels/dock/AppletItemButton.qml +++ b/panels/dock/AppletItemButton.qml @@ -25,7 +25,6 @@ IconButton { icon.width: 16 icon.height: 16 - smooth: false Connections { target: control @@ -39,4 +38,8 @@ IconButton { radius: control.radius isActive: control.isActive } + + Component.onCompleted: { + contentItem.smooth = false + } } diff --git a/panels/dock/taskmanager/package/AppItem.qml b/panels/dock/taskmanager/package/AppItem.qml index b7b39aca3..eefa2721e 100644 --- a/panels/dock/taskmanager/package/AppItem.qml +++ b/panels/dock/taskmanager/package/AppItem.qml @@ -159,8 +159,48 @@ Item { sourceSize: Qt.size(iconSize, iconSize) anchors.centerIn: parent retainWhileLoading: true - smooth: iconSize > 32 + smooth: false + function mapToScene(px, py) { + return parent.mapToItem(Window.window.contentItem, Qt.point(px, py)) + } + + function mapFromScene(px, py) { + return parent.mapFromItem(Window.window.contentItem, Qt.point(px, py)) + } + + function fixPosition() { + anchors.centerIn = undefined + var targetX = (parent.width - width) / 2 + var targetY = (parent.height - height) / 2 + + var scenePos = mapToScene(targetX, targetY) + + var physicalX = Math.round(scenePos.x * Panel.devicePixelRatio) + var physicalY = Math.round(scenePos.y * Panel.devicePixelRatio) + + var localPos = mapFromScene(physicalX / Panel.devicePixelRatio, physicalY / Panel.devicePixelRatio) + + x = localPos.x + y = localPos.y + } + + Timer { + id: fixPositionTimer + interval: 100 + repeat: false + running: false + onTriggered: { + icon.fixPosition() + } + } + + Connections { + target: root + function onIconGlobalPointChanged() { + fixPositionTimer.start() + } + } LaunchAnimation { id: launchAnimation launchSpace: { diff --git a/panels/dock/tray/ShellSurfaceItemProxy.qml b/panels/dock/tray/ShellSurfaceItemProxy.qml index ed0ed781f..5fe978aae 100644 --- a/panels/dock/tray/ShellSurfaceItemProxy.qml +++ b/panels/dock/tray/ShellSurfaceItemProxy.qml @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -17,7 +17,8 @@ Item { property bool hovered: hoverHandler.hovered property bool pressed: tapHandler.pressed property int cursorShape: Qt.ArrowCursor - + property alias shellSurfaceItem: impl + implicitWidth: shellSurface ? shellSurface.width : 10 implicitHeight: shellSurface ? shellSurface.height : 10 @@ -25,6 +26,10 @@ Item { impl.takeFocus() } + function fixPosition() { + fixPositionTimer.start() + } + ShellSurfaceItem { id: impl width: parent.width diff --git a/panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml b/panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml index 410b94abd..2a7fe3919 100644 --- a/panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml +++ b/panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml @@ -75,18 +75,17 @@ AppletItemButton { HoverHandler { id: hoverHandler - parent: surfaceItem + parent: surfaceItem.shellSurfaceItem } TapHandler { id: tapHandler - parent: surfaceItem + parent: surfaceItem.shellSurfaceItem } - ShellSurfaceItem { + DDT.ShellSurfaceItemProxy { id: surfaceItem anchors.fill: parent shellSurface: pluginItem.plugin - smooth: false } Component.onCompleted: { @@ -130,6 +129,7 @@ AppletItemButton { onItemGlobalPosChanged: { updatePluginItemPosTimer.start() + surfaceItem.fixPosition() } onVisibleChanged: { diff --git a/panels/dock/tray/quickpanel/DragItem.qml b/panels/dock/tray/quickpanel/DragItem.qml index 1d50e8b16..d9d1bf77f 100644 --- a/panels/dock/tray/quickpanel/DragItem.qml +++ b/panels/dock/tray/quickpanel/DragItem.qml @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -105,6 +105,7 @@ Item { } Loader { + id: proxyLoader active: isFallbackIcon && root.dragItem.DQuickDrag.isDragging anchors.centerIn: parent anchors.verticalCenterOffset: -root.fallbackIconSize.height / 3 * 2 @@ -114,6 +115,12 @@ Item { height: root.fallbackIconSize.height } } + + onCurrentDragPointChanged: { + if (proxyLoader.item) { + proxyLoader.item.fixPosition() + } + } } DragHandler { diff --git a/panels/dock/tray/quickpanel/PanelTrayItem.qml b/panels/dock/tray/quickpanel/PanelTrayItem.qml index 7b94e8c6c..0b23eea1c 100644 --- a/panels/dock/tray/quickpanel/PanelTrayItem.qml +++ b/panels/dock/tray/quickpanel/PanelTrayItem.qml @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -57,6 +57,7 @@ Control { name: "dock-control-panel" palette: DTK.makeIconPalette(root.palette) theme: root.ColorSelector.controlTheme + smooth: false } HoverHandler { enabled: !root.isOpened