mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Panels Animation: centralizing more code for easier maintenance.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -99,6 +99,9 @@ PanelWindow {
|
||||
onOpacityFadeCompleteChanged: {
|
||||
placeholder.opacityFadeComplete = opacityFadeComplete;
|
||||
}
|
||||
onSizeAnimationCompleteChanged: {
|
||||
placeholder.sizeAnimationComplete = sizeAnimationComplete;
|
||||
}
|
||||
|
||||
// Panel control functions
|
||||
function toggle(buttonItem, buttonName) {
|
||||
|
||||
Reference in New Issue
Block a user