Skip to content

Commit be83223

Browse files
wjyrichdeepin-bot[bot]
authored andcommitted
fix: click area keep same with app on dock.
1. Moved Timer, MouseArea and HoverHandler components out of Icon component hierarchy 2. Added console log for debugging icon dimensions 3. Improved code organization by flattening component structure 4. Maintained all existing functionality while making code more readable The changes were made to: - Simplify the component hierarchy which was unnecessarily nested - Make the code easier to maintain and debug - Prepare for future enhancements by having cleaner structure - Add debugging output for icon dimensions which helps troubleshooting layout issues fix: 修复点击范围保持跟应用一致. 1. 将 Timer、MouseArea 和 HoverHandler 组件移出 Icon 组件层次结构 2. 添加控制台日志用于调试图标尺寸 3. 通过扁平化组件结构改进代码组织 4. 在保持所有现有功能的同时使代码更易读 Pms: BUG-323763
1 parent edc58d2 commit be83223

1 file changed

Lines changed: 28 additions & 28 deletions

File tree

shell-launcher-applet/package/launcheritem.qml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -354,39 +354,39 @@ AppletItem {
354354
sourceSize: Qt.size(Dock.MAX_DOCK_TASKMANAGER_ICON_SIZE, Dock.MAX_DOCK_TASKMANAGER_ICON_SIZE)
355355
onXChanged: updateLaunchpadPos()
356356
onYChanged: updateLaunchpadPos()
357-
Timer {
358-
id: toolTipShowTimer
359-
interval: 50
360-
onTriggered: {
361-
var point = Applet.rootObject.mapToItem(null, Applet.rootObject.width / 2, Applet.rootObject.height / 2)
362-
toolTip.DockPanelPositioner.bounding = Qt.rect(point.x, point.y, toolTip.width, toolTip.height)
363-
toolTip.open()
364-
}
357+
}
358+
Timer {
359+
id: toolTipShowTimer
360+
interval: 50
361+
onTriggered: {
362+
var point = Applet.rootObject.mapToItem(null, Applet.rootObject.width / 2, Applet.rootObject.height / 2)
363+
toolTip.DockPanelPositioner.bounding = Qt.rect(point.x, point.y, toolTip.width, toolTip.height)
364+
toolTip.open()
365365
}
366+
}
366367

367-
// FIXME: The TapHandler receives the event after visibleChange, which causes the state to be inverted after synchronization,
368-
// causing the launchpad to be displayed again. However, the MouseArea receives the event before visibleChange.
369-
MouseArea {
370-
id: mouseHandler
371-
anchors.fill: parent
372-
onClicked: function (mouse) {
373-
if (mouse.button === Qt.LeftButton) {
374-
LauncherController.visible = !LauncherController.visible
375-
toolTip.close()
376-
}
368+
// FIXME: The TapHandler receives the event after visibleChange, which causes the state to be inverted after synchronization,
369+
// causing the launchpad to be displayed again. However, the MouseArea receives the event before visibleChange.
370+
MouseArea {
371+
id: mouseHandler
372+
anchors.fill: parent
373+
onClicked: function (mouse) {
374+
if (mouse.button === Qt.LeftButton) {
375+
LauncherController.visible = !LauncherController.visible
376+
toolTip.close()
377377
}
378378
}
379-
HoverHandler {
380-
onHoveredChanged: {
381-
if (hovered) {
382-
toolTipShowTimer.start()
383-
} else {
384-
if (toolTipShowTimer.running) {
385-
toolTipShowTimer.stop()
386-
}
387-
388-
toolTip.close()
379+
}
380+
HoverHandler {
381+
onHoveredChanged: {
382+
if (hovered) {
383+
toolTipShowTimer.start()
384+
} else {
385+
if (toolTipShowTimer.running) {
386+
toolTipShowTimer.stop()
389387
}
388+
389+
toolTip.close()
390390
}
391391
}
392392
}

0 commit comments

Comments
 (0)