Skip to content

Commit ee59c2e

Browse files
committed
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 832e381 commit ee59c2e

2 files changed

Lines changed: 26 additions & 7 deletions

File tree

panels/notification/bubble/package/BubbleDelegate.qml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,33 @@ import QtQuick.Controls 2.15
77

88
Item {
99
id: delegateRoot
10-
width: 360
10+
width: ListView.view ? ListView.view.width : 360
11+
property var applet
1112
property var bubble: model
1213
property int maxCount: 3
1314
// ListView 的 remove 动画执行的时候,remove Item的index会以负数的方式出现
1415
property int realIndex: index < 0 ? ListView.view.count + index : index;
1516

1617
height: bubbleContent.height
1718
z: -realIndex
19+
20+
HoverHandler {
21+
id: delegateHoverHandler
22+
margin: 8
23+
onHoveredChanged: {
24+
if (delegateRoot.applet) {
25+
delegateRoot.applet.setHoveredId(hovered && delegateRoot.bubble ? delegateRoot.bubble.id : 0)
26+
}
27+
}
28+
}
29+
1830
Bubble {
1931
id: bubbleContent
2032
width: 360
33+
anchors.right: parent.right
34+
anchors.rightMargin: 10
2135
bubble: delegateRoot.bubble
36+
parentHovered: delegateHoverHandler.hovered
2237

2338
transformOrigin: Item.Top
2439

panels/notification/bubble/package/main.qml

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

9292
ListView {
9393
id: bubbleView
94-
width: 360
94+
width: root.width
9595
height: contentHeight
9696
anchors {
9797
right: parent.right
9898
bottom: parent.bottom
99-
rightMargin: 10
99+
rightMargin: 0
100100
bottomMargin: 10
101101
}
102102

103103
function updateInputRegion() {
104104
root.DLayerShellWindow.setInputRegionRect(
105105
Math.ceil(bubbleView.x),
106-
Math.ceil(bubbleView.y),
107-
Math.ceil(bubbleView.width),
108-
Math.ceil(Math.max(10, bubbleView.contentHeight))
106+
Math.ceil(bubbleView.y - 8),
107+
Math.ceil(root.width),
108+
Math.ceil(Math.max(10, bubbleView.contentHeight) + 8)
109109
)
110110
}
111111
onContentHeightChanged: updateInputRegion()
@@ -167,13 +167,17 @@ Window {
167167
}
168168

169169
delegate: BubbleDelegate {
170+
applet: Applet
170171
maxCount: model.bubbleCount
171172
}
172173

173174
HoverHandler {
175+
margin: 8
174176
onPointChanged: {
175177
const local = point.position
176-
let hoveredItem = bubbleView.itemAt(local.x, local.y)
178+
const x = Math.min(Math.max(local.x, 0), bubbleView.width - 1)
179+
const y = Math.min(Math.max(local.y, 0), bubbleView.height - 1)
180+
let hoveredItem = bubbleView.itemAt(x, y)
177181
if (hoveredItem && hoveredItem.bubble) {
178182
Applet.setHoveredId(hoveredItem.bubble.id)
179183
} else {

0 commit comments

Comments
 (0)