notifs: better sliding

Wrap with clippingrect so x doesnt reset when element is added/removed
Also clippingrect rounds the ends when sliding
This commit is contained in:
2 * r + 2 * t 2025-05-13 14:17:24 +10:00
parent 22a99154b7
commit c64e602725
2 changed files with 18 additions and 10 deletions

View file

@ -2,6 +2,7 @@ import "root:/widgets"
import "root:/services"
import "root:/config"
import Quickshell
import Quickshell.Widgets
import QtQuick
Item {
@ -34,20 +35,25 @@ Item {
return Math.max(61, height);
}
clip: true
orientation: Qt.Vertical
spacing: Appearance.spacing.smaller
interactive: false
delegate: Notification {}
delegate: ClippingRectangle {
id: wrapper
add: Transition {
Anim {
property: "x"
from: NotifsConfig.sizes.width
to: 0
duration: Appearance.anim.durations.large
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
required property Notifs.Notif modelData
readonly property alias nonAnimHeight: notif.nonAnimHeight
color: "transparent"
radius: notif.radius
implicitWidth: notif.width
implicitHeight: notif.height
Notification {
id: notif
modelData: wrapper.modelData
}
}

View file

@ -18,12 +18,14 @@ StyledRect {
readonly property int nonAnimHeight: summary.implicitHeight + (root.expanded ? appName.height + body.height + actions.height + actions.anchors.topMargin : bodyPreview.height) + inner.anchors.margins * 2
property bool expanded
clip: true
color: root.modelData.urgency === NotificationUrgency.Critical ? Colours.palette.m3secondaryContainer : Colours.palette.m3surfaceContainer
radius: Appearance.rounding.normal
implicitWidth: NotifsConfig.sizes.width
implicitHeight: inner.height
x: NotifsConfig.sizes.width
Component.onCompleted: x = 0
MouseArea {
property int startY