Panels Animation: centralizing more code for easier maintenance.

This commit is contained in:
ItsLemmy
2025-11-22 10:43:57 -05:00
parent b93b74ae59
commit 152c8efaa1
2 changed files with 10 additions and 6 deletions
+7 -6
View File
@@ -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
}
+3
View File
@@ -99,6 +99,9 @@ PanelWindow {
onOpacityFadeCompleteChanged: {
placeholder.opacityFadeComplete = opacityFadeComplete;
}
onSizeAnimationCompleteChanged: {
placeholder.sizeAnimationComplete = sizeAnimationComplete;
}
// Panel control functions
function toggle(buttonItem, buttonName) {