From 58d711b3e940fdab93eedf353567da85a66978e6 Mon Sep 17 00:00:00 2001 From: bbedward Date: Mon, 14 Jul 2025 13:54:06 -0400 Subject: [PATCH] Fix event animation --- .../CenterCommandCenter.qml | 18 ++++++++++++------ Widgets/CenterCommandCenter/EventsWidget.qml | 10 +++++++++- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Widgets/CenterCommandCenter/CenterCommandCenter.qml b/Widgets/CenterCommandCenter/CenterCommandCenter.qml index 4a445f30..0e3286bc 100644 --- a/Widgets/CenterCommandCenter/CenterCommandCenter.qml +++ b/Widgets/CenterCommandCenter/CenterCommandCenter.qml @@ -76,9 +76,10 @@ PanelWindow { contentHeight += mainRowHeight + theme.spacingM // Add spacing between main row and events - // Add events widget height - dynamically calculated + // Add events widget height - use calculated height instead of actual if (CalendarService && CalendarService.khalAvailable) { - let eventsHeight = eventsWidget.height || 120 // Use actual widget height or fallback + let hasEvents = eventsWidget.selectedDateEvents && eventsWidget.selectedDateEvents.length > 0 + let eventsHeight = hasEvents ? Math.min(300, 80 + eventsWidget.selectedDateEvents.length * 60) : 120 contentHeight += eventsHeight } @@ -136,6 +137,15 @@ PanelWindow { } } + // Update height when events widget's selectedDateEvents changes + Connections { + target: eventsWidget + enabled: eventsWidget !== null + function onSelectedDateEventsChanged() { + mainContainer.height = mainContainer.calculateHeight() + } + } + Behavior on opacity { NumberAnimation { duration: theme.longDuration @@ -216,10 +226,6 @@ PanelWindow { theme: centerCommandCenter.theme selectedDate: calendarWidget.selectedDate - // Update container height when events widget height changes - onHeightChanged: { - mainContainer.height = mainContainer.calculateHeight() - } } } } diff --git a/Widgets/CenterCommandCenter/EventsWidget.qml b/Widgets/CenterCommandCenter/EventsWidget.qml index 9f48e9d9..f386297a 100644 --- a/Widgets/CenterCommandCenter/EventsWidget.qml +++ b/Widgets/CenterCommandCenter/EventsWidget.qml @@ -136,7 +136,8 @@ Rectangle { anchors.bottom: parent.bottom anchors.margins: theme.spacingL anchors.topMargin: theme.spacingM - visible: hasEvents + visible: opacity > 0 + opacity: hasEvents ? 1.0 : 0.0 clip: true spacing: theme.spacingS boundsMovement: Flickable.StopAtBounds @@ -146,6 +147,13 @@ Rectangle { policy: eventsList.contentHeight > eventsList.height ? ScrollBar.AsNeeded : ScrollBar.AlwaysOff } + Behavior on opacity { + NumberAnimation { + duration: theme.mediumDuration + easing.type: theme.emphasizedEasing + } + } + delegate: Rectangle { width: eventsList.width height: eventContent.implicitHeight + theme.spacingM