From 812dd207d49c12eceb657d84035b01cce3ce00ad Mon Sep 17 00:00:00 2001 From: reionwong Date: Sun, 31 Oct 2021 17:08:05 +0800 Subject: [PATCH] Notification: Click top to jump to the top --- notificationd/qml/NotificationWindow.qml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/notificationd/qml/NotificationWindow.qml b/notificationd/qml/NotificationWindow.qml index cec4721..f98c703 100644 --- a/notificationd/qml/NotificationWindow.qml +++ b/notificationd/qml/NotificationWindow.qml @@ -81,6 +81,16 @@ Item { enabled: true } + NumberAnimation { + id: scrollToTopAni + target: _view + from: 0 + to: 0 + property: "contentY" + duration: 200 + easing.type: Easing.OutSine + } + ColumnLayout { anchors.fill: parent anchors.margins: FishUI.Units.largeSpacing @@ -94,6 +104,18 @@ Item { leftPadding: FishUI.Units.smallSpacing color: FishUI.Theme.textColor font.pointSize: 15 + + MouseArea { + anchors.fill: parent + onClicked: { + if (_view.contentY === 0) + return + + scrollToTopAni.from = _view.contentY + scrollToTopAni.to = 0 + scrollToTopAni.restart() + } + } } IconButton {