sidebar/notifs: fix clear all button & expand bugs

Disable expand on drag on notifs when expanded (fixes drag expansion bugs and feels better)
Also add scrollbar
This commit is contained in:
2 * r + 2 * t 2025-09-19 22:59:45 +10:00
parent 3fb78654a2
commit 7efc0d54ea
2 changed files with 6 additions and 4 deletions

View file

@ -98,6 +98,8 @@ Item {
values: [...new Set(Notifs.list.filter(n => !n.closed).map(n => n.appName))].reverse() values: [...new Set(Notifs.list.filter(n => !n.closed).map(n => n.appName))].reverse()
} }
StyledScrollBar.vertical: StyledScrollBar {}
delegate: MouseArea { delegate: MouseArea {
id: notif id: notif
@ -218,7 +220,7 @@ Item {
interval: 50 interval: 50
onTriggered: { onTriggered: {
if (root.notifCount > 0) if (root.notifCount > 0)
Notifs.list[0].close(); Notifs.list.find(n => !n.closed).close();
else else
stop(); stop();
} }
@ -239,7 +241,7 @@ Item {
icon: "clear_all" icon: "clear_all"
radius: Appearance.rounding.normal radius: Appearance.rounding.normal
padding: Appearance.padding.normal padding: Appearance.padding.normal
font.pointSize: Math.round(Appearance.font.size.large * 1.3) font.pointSize: Math.round(Appearance.font.size.large * 1.2)
onClicked: clearTimer.start() onClicked: clearTimer.start()
Elevation { Elevation {

View file

@ -59,7 +59,7 @@ Item {
hoverEnabled: true hoverEnabled: true
cursorShape: pressed ? Qt.ClosedHandCursor : undefined cursorShape: pressed ? Qt.ClosedHandCursor : undefined
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
preventStealing: true preventStealing: !root.expanded
drag.target: this drag.target: this
drag.axis: Drag.XAxis drag.axis: Drag.XAxis
@ -72,7 +72,7 @@ Item {
modelData.close(); modelData.close();
} }
onPositionChanged: event => { onPositionChanged: event => {
if (pressed) { if (pressed && !root.expanded) {
const diffY = event.y - startY; const diffY = event.y - startY;
if (Math.abs(diffY) > Config.notifs.expandThreshold) if (Math.abs(diffY) > Config.notifs.expandThreshold)
root.requestToggleExpand(diffY > 0); root.requestToggleExpand(diffY > 0);