mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-07-31 16:54:46 +00:00
lockscreen: Fix clock getting animated right after load
Restores a fix for https://invent.kde.org/plasma/plasma-mobile/-/issues/381 The pw notifications model right at load appears to say there are notifications at load, but then fixes itself once the component finishes loading.
This commit is contained in:
parent
6b41f0c354
commit
403b11c2d7
1 changed files with 13 additions and 3 deletions
|
|
@ -29,13 +29,16 @@ Item {
|
||||||
visible: root.isVertical
|
visible: root.isVertical
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
// center clock when no notifications are shown, otherwise move the clock upward
|
// Center clock when no notifications are shown, otherwise move the clock upward
|
||||||
anchors.topMargin: !root.notificationsShown ? Math.round(root.fullHeight / 2 - (verticalLayout.implicitHeight / 2)) : Kirigami.Units.gridUnit * 5
|
anchors.topMargin: root.notificationsShown ? Kirigami.Units.gridUnit * 5 : Math.round(root.fullHeight / 2 - (verticalLayout.implicitHeight / 2))
|
||||||
anchors.bottomMargin: Kirigami.Units.gridUnit
|
anchors.bottomMargin: Kirigami.Units.gridUnit
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
// animate
|
// Animate clock centering change when notifications come in
|
||||||
Behavior on anchors.topMargin {
|
Behavior on anchors.topMargin {
|
||||||
|
id: topMarginAnim
|
||||||
|
enabled: false
|
||||||
|
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: Kirigami.Units.veryLongDuration
|
duration: Kirigami.Units.veryLongDuration
|
||||||
easing.type: Easing.InOutExpo
|
easing.type: Easing.InOutExpo
|
||||||
|
|
@ -46,6 +49,13 @@ Item {
|
||||||
LayoutItemProxy { target: notificationComponent }
|
LayoutItemProxy { target: notificationComponent }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HACK: don't animate top margin at beginning, while notification model figures itself out
|
||||||
|
Timer {
|
||||||
|
running: true
|
||||||
|
repeat: false
|
||||||
|
onTriggered: topMarginAnim.enabled = true
|
||||||
|
}
|
||||||
|
|
||||||
// Horizontal layout (landscape on smaller devices)
|
// Horizontal layout (landscape on smaller devices)
|
||||||
Item {
|
Item {
|
||||||
id: horizontalLayout
|
id: horizontalLayout
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue