From 152c8efaa13e29b4f5f8739711d086701d76c4bd Mon Sep 17 00:00:00 2001 From: ItsLemmy Date: Sat, 22 Nov 2025 10:43:57 -0500 Subject: [PATCH] Panels Animation: centralizing more code for easier maintenance. --- Modules/MainScreen/PanelPlaceholder.qml | 13 +++++++------ Modules/MainScreen/SmartPanelWindow.qml | 3 +++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Modules/MainScreen/PanelPlaceholder.qml b/Modules/MainScreen/PanelPlaceholder.qml index 2b69205e..405be4de 100644 --- a/Modules/MainScreen/PanelPlaceholder.qml +++ b/Modules/MainScreen/PanelPlaceholder.qml @@ -47,6 +47,10 @@ Item { property bool isPanelVisible: false property bool isClosing: false property bool opacityFadeComplete: false + property bool sizeAnimationComplete: false + + // Derived state: track opening transition + readonly property bool isOpening: isPanelVisible && !isClosing && !sizeAnimationComplete // Content size (set by SmartPanelWindow when content size changes) property real contentPreferredWidth: 0 @@ -563,11 +567,8 @@ Item { readonly property bool shouldAnimateWidth: !shouldAnimateHeight && (animateFromLeft || animateFromRight) readonly property bool shouldAnimateHeight: animateFromTop || animateFromBottom - // Track whether we're opening (becoming visible but not yet at full size) - readonly property bool isOpening: root.isPanelVisible && !root.isClosing && (width < targetWidth || height < targetHeight) - // Track whether we're in an initial open/close state transition vs normal content resizing - readonly property bool isStateTransition: isOpening || root.isClosing + readonly property bool isStateTransition: root.isOpening || root.isClosing // Current animated width/height readonly property real currentWidth: { @@ -612,7 +613,7 @@ Item { // During opening: use 0ms if not animating width, otherwise use normal duration // During closing: use 0ms if not animating width, otherwise use fast duration // During normal content resizing: always use normal duration - duration: (panelBackground.isOpening && !panelBackground.shouldAnimateWidth) ? 0 : panelBackground.isOpening ? Style.animationNormal : (root.isClosing && !panelBackground.shouldAnimateWidth) ? 0 : root.isClosing ? Style.animationFast : Style.animationNormal + duration: (root.isOpening && !panelBackground.shouldAnimateWidth) ? 0 : root.isOpening ? Style.animationNormal : (root.isClosing && !panelBackground.shouldAnimateWidth) ? 0 : root.isClosing ? Style.animationFast : Style.animationNormal easing.type: Easing.BezierSpline easing.bezierCurve: panelBackground.bezierCurve } @@ -623,7 +624,7 @@ Item { // During opening: use 0ms if not animating height, otherwise use normal duration // During closing: use 0ms if not animating height, otherwise use fast duration // During normal content resizing: always use normal duration - duration: (panelBackground.isOpening && !panelBackground.shouldAnimateHeight) ? 0 : panelBackground.isOpening ? Style.animationNormal : (root.isClosing && !panelBackground.shouldAnimateHeight) ? 0 : root.isClosing ? Style.animationFast : Style.animationNormal + duration: (root.isOpening && !panelBackground.shouldAnimateHeight) ? 0 : root.isOpening ? Style.animationNormal : (root.isClosing && !panelBackground.shouldAnimateHeight) ? 0 : root.isClosing ? Style.animationFast : Style.animationNormal easing.type: Easing.BezierSpline easing.bezierCurve: panelBackground.bezierCurve } diff --git a/Modules/MainScreen/SmartPanelWindow.qml b/Modules/MainScreen/SmartPanelWindow.qml index 09a6764d..de47ff29 100644 --- a/Modules/MainScreen/SmartPanelWindow.qml +++ b/Modules/MainScreen/SmartPanelWindow.qml @@ -99,6 +99,9 @@ PanelWindow { onOpacityFadeCompleteChanged: { placeholder.opacityFadeComplete = opacityFadeComplete; } + onSizeAnimationCompleteChanged: { + placeholder.sizeAnimationComplete = sizeAnimationComplete; + } // Panel control functions function toggle(buttonItem, buttonName) {