Skip to content

Commit bd6ae92

Browse files
wjyrichdeepin-bot[bot]
authored andcommitted
fix: click area keep same with app on dock
1. Restructured tooltip timer and positioning logic outside the Image component 2. Replaced TapHandler with MouseArea for better click handling consistency 3. Fixed tooltip positioning by using toggleworkspace coordinates instead of Applet.rootObject 4. Maintained hover behavior but with cleaner separation of concerns The changes improve the reliability of the workspace switching functionality and tooltip display in the dock's multitask view. The new MouseArea provides more consistent click handling compared to the previous TapHandler implementation. The tooltip positioning is now more accurate as it uses the correct coordinate space. fix: 修复点击范围保持跟应用一致. 1. 将工具提示计时器和定位逻辑从Image组件中移出并重构 2. 用MouseArea替换TapHandler以获得更一致的点击处理 3. 通过使用toggleworkspace坐标而非Applet.rootObject修复工具提示定位 4. 保持悬停行为但实现了更清晰的关注点分离 这些改动提高了dock中多任务视图的工作区切换功能和工具提示显示的可靠性。新 的MouseArea相比之前的TapHandler提供了更一致的点击处理。工具提示定位现在 更加准确,因为它使用了正确的坐标空间。 Pms: BUG-323763
1 parent c7790af commit bd6ae92

File tree

1 file changed

+26
-21
lines changed

1 file changed

+26
-21
lines changed

panels/dock/multitaskview/package/multitaskview.qml

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,33 +32,38 @@ AppletItem {
3232
scale: Panel.rootObject.dockItemMaxSize * 9 / 14 / Dock.MAX_DOCK_TASKMANAGER_ICON_SIZE
3333
// 9:14 (iconSize/dockHeight)
3434
sourceSize: Qt.size(Dock.MAX_DOCK_TASKMANAGER_ICON_SIZE, Dock.MAX_DOCK_TASKMANAGER_ICON_SIZE)
35-
Timer {
36-
id: toolTipShowTimer
37-
interval: 50
38-
onTriggered: {
39-
var point = Applet.rootObject.mapToItem(null, Applet.rootObject.width / 2, Applet.rootObject.height / 2)
40-
toolTip.DockPanelPositioner.bounding = Qt.rect(point.x, point.y, toolTip.width, toolTip.height)
41-
toolTip.open()
42-
}
35+
}
36+
37+
Timer {
38+
id: toolTipShowTimer
39+
interval: 50
40+
onTriggered: {
41+
var point = toggleworkspace.mapToItem(null, toggleworkspace.width / 2, toggleworkspace.height / 2)
42+
toolTip.DockPanelPositioner.bounding = Qt.rect(point.x, point.y, toolTip.width, toolTip.height)
43+
toolTip.open()
4344
}
44-
TapHandler {
45-
acceptedButtons: Qt.LeftButton
46-
onTapped: {
45+
}
46+
47+
MouseArea {
48+
id: mouseHandler
49+
anchors.fill: parent
50+
onClicked: function (mouse) {
51+
if (mouse.button === Qt.LeftButton) {
4752
Applet.openWorkspace()
4853
toolTip.close()
4954
}
5055
}
51-
HoverHandler {
52-
onHoveredChanged: {
53-
if (hovered) {
54-
toolTipShowTimer.start()
55-
} else {
56-
if (toolTipShowTimer.running) {
57-
toolTipShowTimer.stop()
58-
}
59-
60-
toolTip.close()
56+
}
57+
HoverHandler {
58+
onHoveredChanged: {
59+
if (hovered) {
60+
toolTipShowTimer.start()
61+
} else {
62+
if (toolTipShowTimer.running) {
63+
toolTipShowTimer.stop()
6164
}
65+
66+
toolTip.close()
6267
}
6368
}
6469
}

0 commit comments

Comments
 (0)