diff options
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/lock/Status.qml | 36 | ||||
| -rw-r--r-- | modules/notifications/Content.qml | 42 |
2 files changed, 44 insertions, 34 deletions
diff --git a/modules/lock/Status.qml b/modules/lock/Status.qml index a3a0cac..65331b1 100644 --- a/modules/lock/Status.qml +++ b/modules/lock/Status.qml @@ -220,41 +220,9 @@ WrapperItem { } } - StyledRect { + ExtraIndicator { anchors.bottom: parent.bottom - anchors.right: parent.right - anchors.margins: Appearance.padding.normal - - color: Colours.palette.m3tertiaryContainer - radius: Appearance.rounding.small - - implicitWidth: count.implicitWidth + Appearance.padding.normal * 2 - implicitHeight: count.implicitHeight + Appearance.padding.small * 2 - - opacity: Notifs.list.length > Config.lock.maxNotifs ? 1 : 0 - scale: Notifs.list.length > Config.lock.maxNotifs ? 1 : 0.8 - - StyledText { - id: count - - anchors.centerIn: parent - text: qsTr("+%1").arg(Notifs.list.length - Config.lock.maxNotifs) - color: Colours.palette.m3onTertiaryContainer - } - - Behavior on opacity { - Anim { - duration: Appearance.anim.durations.expressiveFastSpatial - easing.bezierCurve: Appearance.anim.curves.standard - } - } - - Behavior on scale { - Anim { - duration: Appearance.anim.durations.expressiveFastSpatial - easing.bezierCurve: Appearance.anim.curves.expressiveFastSpatial - } - } + extra: Notifs.list.length - Config.lock.maxNotifs } } } diff --git a/modules/notifications/Content.qml b/modules/notifications/Content.qml index 6983b95..108f8d3 100644 --- a/modules/notifications/Content.qml +++ b/modules/notifications/Content.qml @@ -147,6 +147,48 @@ Item { property: "y" } } + + ExtraIndicator { + anchors.top: parent.top + extra: { + const count = list.count; + if (count === 0) + return 0; + + const scrollY = list.contentY; + + let height = 0; + for (let i = 0; i < count; i++) { + height += (list.itemAtIndex(i)?.nonAnimHeight ?? 0) + Appearance.spacing.smaller; + + if (height - Appearance.spacing.smaller >= scrollY) + return i; + } + + return count; + } + } + + ExtraIndicator { + anchors.bottom: parent.bottom + extra: { + const count = list.count; + if (count === 0) + return 0; + + const scrollY = list.contentHeight - (list.contentY + list.height); + + let height = 0; + for (let i = count - 1; i >= 0; i--) { + height += (list.itemAtIndex(i)?.nonAnimHeight ?? 0) + Appearance.spacing.smaller; + + if (height - Appearance.spacing.smaller >= scrollY) + return count - i - 1; + } + + return 0; + } + } } } |