diff options
| author | ATMDA <atdma2600@gmail.com> | 2025-11-16 13:18:28 -0500 |
|---|---|---|
| committer | ATMDA <atdma2600@gmail.com> | 2025-11-16 13:18:28 -0500 |
| commit | 0e1be8126a4fab3802719ebb3d85f752282be491 (patch) | |
| tree | 592b55d43b2cb0792adf812519c37d5dffdbbb32 /modules | |
| parent | controlcenter: corrected missing config.save() on panes (diff) | |
| download | caelestia-shell-0e1be8126a4fab3802719ebb3d85f752282be491.tar.gz caelestia-shell-0e1be8126a4fab3802719ebb3d85f752282be491.tar.bz2 caelestia-shell-0e1be8126a4fab3802719ebb3d85f752282be491.zip | |
controlcenter: delay heavy operations until animation completes
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/controlcenter/Panes.qml | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/modules/controlcenter/Panes.qml b/modules/controlcenter/Panes.qml index 5238624..8c76deb 100644 --- a/modules/controlcenter/Panes.qml +++ b/modules/controlcenter/Panes.qml @@ -49,6 +49,16 @@ ClippingRectangle { y: -root.session.activeIndex * root.height clip: true + property bool animationComplete: true + + Timer { + id: animationDelayTimer + interval: Appearance.anim.durations.normal + onTriggered: { + layout.animationComplete = true; + } + } + Pane { index: 0 sourceComponent: NetworkingPane { @@ -94,6 +104,15 @@ ClippingRectangle { Behavior on y { Anim {} } + + Connections { + target: root.session + function onActiveIndexChanged(): void { + // Mark animation as incomplete and start delay timer + layout.animationComplete = false; + animationDelayTimer.restart(); + } + } } component Pane: Item { @@ -112,10 +131,15 @@ ClippingRectangle { clip: false asynchronous: true active: { - // Keep loaders active for current and adjacent panels - // This prevents content from disappearing during panel transitions const diff = Math.abs(root.session.activeIndex - pane.index); - return diff <= 1; + + // Always activate current and adjacent panes immediately for smooth transitions + if (diff <= 1) { + return true; + } + + // For distant panes, wait until animation completes to avoid heavy loading during transition + return layout.animationComplete; } } } |