feat: use behavior for launcher anim

No need for initial load
This commit is contained in:
2 * r + 2 * t 2026-03-26 16:13:00 +11:00
parent 8a5905c9df
commit d7d53260a7

View file

@ -29,63 +29,18 @@ Item {
} }
readonly property real nonAnimHeight: state === "visible" ? ((content.item as Content)?.nonAnimHeight ?? 0) : 0 readonly property real nonAnimHeight: state === "visible" ? ((content.item as Content)?.nonAnimHeight ?? 0) : 0
readonly property bool shouldBeActive: visibilities.dashboard && Config.dashboard.enabled
property real offsetScale: shouldBeActive ? 0 : 1
visible: anchors.topMargin > -implicitHeight - 5 visible: offsetScale < 1
anchors.topMargin: -implicitHeight - 5 anchors.topMargin: (-implicitHeight - 5) * offsetScale
implicitHeight: content.implicitHeight implicitHeight: content.implicitHeight
implicitWidth: content.implicitWidth implicitWidth: content.implicitWidth || 854 // Hard coded fallback for first open
onStateChanged: { Behavior on offsetScale {
if (state === "visible" && timer.running) { Anim {
timer.triggered(); duration: Appearance.anim.durations.expressiveDefaultSpatial
timer.stop(); easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
}
}
states: State {
name: "visible"
when: root.visibilities.dashboard && Config.dashboard.enabled
PropertyChanges {
// root.implicitHeight: content.implicitHeight
root.anchors.topMargin: 0
}
}
transitions: [
Transition {
// from: ""
// to: "visible"
Anim {
target: root.anchors
property: "topMargin"
duration: Appearance.anim.durations.expressiveDefaultSpatial
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
}
}
// Transition {
// from: "visible"
// to: ""
// Anim {
// target: root.anchors
// property: "topMargin"
// easing.bezierCurve: Appearance.anim.curves.emphasized
// }
// }
]
Timer {
id: timer
running: true
interval: Appearance.anim.durations.extraLarge
onTriggered: {
content.active = Qt.binding(() => (root.visibilities.dashboard && Config.dashboard.enabled) || root.visible);
content.visible = true;
} }
} }
@ -95,8 +50,7 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
visible: false active: root.shouldBeActive || root.visible
active: true
sourceComponent: Content { sourceComponent: Content {
visibilities: root.visibilities visibilities: root.visibilities