controlcenter: delay heavy operations until animation completes

This commit is contained in:
ATMDA 2025-11-16 13:18:28 -05:00
parent d751b68bdf
commit 0e1be8126a

View file

@ -49,6 +49,16 @@ ClippingRectangle {
y: -root.session.activeIndex * root.height y: -root.session.activeIndex * root.height
clip: true clip: true
property bool animationComplete: true
Timer {
id: animationDelayTimer
interval: Appearance.anim.durations.normal
onTriggered: {
layout.animationComplete = true;
}
}
Pane { Pane {
index: 0 index: 0
sourceComponent: NetworkingPane { sourceComponent: NetworkingPane {
@ -94,6 +104,15 @@ ClippingRectangle {
Behavior on y { Behavior on y {
Anim {} Anim {}
} }
Connections {
target: root.session
function onActiveIndexChanged(): void {
// Mark animation as incomplete and start delay timer
layout.animationComplete = false;
animationDelayTimer.restart();
}
}
} }
component Pane: Item { component Pane: Item {
@ -112,10 +131,15 @@ ClippingRectangle {
clip: false clip: false
asynchronous: true asynchronous: true
active: { 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); 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;
} }
} }
} }