Skip to content

Commit f32118b

Browse files
robertkilldeepin-bot[bot]
authored andcommitted
fix: keep notification hover state on close button edge
1. Extend the notification bubble input area to cover the close button edge outside the notification card background 2. Keep the bubble delegate width aligned with the expanded input area while preserving the 360px notification content layout and right margin 3. Use the delegate hover state to keep the close button visible and block timeout closing while the pointer stays on the edge area Influence: 1. Test notification bubble hover on the notification body and close button edge 2. Verify the close button remains visible when hovering its top-right edge 3. Verify hovered notifications do not expire automatically 4. Verify notification position and stacking animation remain unchanged fix: 保持通知关闭按钮边缘区域悬停状态 1. 扩展通知气泡输入区域,覆盖通知卡片背景外的关闭按钮边缘区域 2. 保持delegate宽度与扩展后的输入区域一致,同时保留360px通知内容布局和右边距 3. 使用delegate悬停状态保持关闭按钮显示,并在指针位于边缘区域时阻止通知超时关闭 Influence: 1. 测试通知主体和关闭按钮边缘区域的悬停效果 2. 验证鼠标悬停在右上角关闭按钮边缘时关闭按钮持续显示 3. 验证悬停状态下通知不会自动超时消失 4. 验证通知显示位置和堆叠动画保持不变 PMS: BUG-365963
1 parent 21a88dd commit f32118b

2 files changed

Lines changed: 26 additions & 24 deletions

File tree

panels/notification/bubble/package/BubbleDelegate.qml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,37 @@
55
import QtQuick 2.15
66
import QtQuick.Controls 2.15
77

8+
import org.deepin.ds 1.0
9+
810
Item {
911
id: delegateRoot
10-
width: 360
12+
width: ListView.view ? ListView.view.width : 360
13+
// Close button overhang: half of 20px button height minus 2px visual offset
14+
// (see NotifyItemContent.qml closePlaceHolder topMargin: -height / 2 + 2)
15+
readonly property int closeButtonOverhang: 8
1116
property var bubble: model
1217
property int maxCount: 3
1318
// ListView 的 remove 动画执行的时候,remove Item的index会以负数的方式出现
1419
property int realIndex: index < 0 ? ListView.view.count + index : index;
1520

1621
height: bubbleContent.height
1722
z: -realIndex
23+
24+
HoverHandler {
25+
id: delegateHoverHandler
26+
margin: delegateRoot.closeButtonOverhang
27+
onHoveredChanged: {
28+
Applet.setHoveredId(hovered && delegateRoot.bubble ? delegateRoot.bubble.id : 0)
29+
}
30+
}
31+
1832
Bubble {
1933
id: bubbleContent
2034
width: 360
35+
anchors.right: parent.right
36+
anchors.rightMargin: 10
2137
bubble: delegateRoot.bubble
38+
parentHovered: delegateHoverHandler.hovered
2239

2340
transformOrigin: Item.Top
2441

panels/notification/bubble/package/main.qml

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,24 @@ Window {
9191

9292
ListView {
9393
id: bubbleView
94-
width: 360
94+
// Close button overhang: half of 20px button height minus 2px visual offset
95+
// (see NotifyItemContent.qml closePlaceHolder topMargin: -height / 2 + 2)
96+
readonly property int closeButtonOverhang: 8
97+
width: root.width
9598
height: contentHeight
9699
anchors {
97100
right: parent.right
98101
bottom: parent.bottom
99-
rightMargin: 10
102+
rightMargin: 0
100103
bottomMargin: 10
101104
}
102105

103106
function updateInputRegion() {
104107
root.DLayerShellWindow.setInputRegionRect(
105108
Math.ceil(bubbleView.x),
106-
Math.ceil(bubbleView.y),
107-
Math.ceil(bubbleView.width),
108-
Math.ceil(Math.max(10, bubbleView.contentHeight))
109+
Math.ceil(bubbleView.y - bubbleView.closeButtonOverhang),
110+
Math.ceil(root.width),
111+
Math.ceil(Math.max(10, bubbleView.contentHeight) + bubbleView.closeButtonOverhang)
109112
)
110113
}
111114
onContentHeightChanged: updateInputRegion()
@@ -169,23 +172,5 @@ Window {
169172
delegate: BubbleDelegate {
170173
maxCount: model.bubbleCount
171174
}
172-
173-
HoverHandler {
174-
onPointChanged: {
175-
const local = point.position
176-
let hoveredItem = bubbleView.itemAt(local.x, local.y)
177-
if (hoveredItem && hoveredItem.bubble) {
178-
Applet.setHoveredId(hoveredItem.bubble.id)
179-
} else {
180-
Applet.setHoveredId(0)
181-
}
182-
}
183-
184-
onHoveredChanged: {
185-
if (!hovered) {
186-
Applet.setHoveredId(0)
187-
}
188-
}
189-
}
190175
}
191176
}

0 commit comments

Comments
 (0)