From a74f2a021180300c3bb9e639657fdd19a52cc197 Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Mon, 23 Mar 2026 11:58:42 +0100 Subject: [PATCH] polish: add fade-out exit animation to ConsoleGameDetail Add startClose() which plays a 160ms InCubic fade-out before emitting close(). Back/Escape triggers now call startClose() instead of close() directly. visible keeps the item rendered during the exit animation via isClosing flag. Launch path bypasses animation (immediate). --- src/qml/ConsoleGameDetail.qml | 37 +++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/src/qml/ConsoleGameDetail.qml b/src/qml/ConsoleGameDetail.qml index 02ef8c0..ac9f906 100644 --- a/src/qml/ConsoleGameDetail.qml +++ b/src/qml/ConsoleGameDetail.qml @@ -19,15 +19,24 @@ Item { signal editRequested() signal removeRequested() - visible: game !== null + property bool isClosing: false + + visible: game !== null || isClosing focus: visible - Keys.onEscapePressed: detailRoot.close() + function startClose() { + if (isClosing) return + isClosing = true + fadeIn.stop() + fadeOut.start() + } + + Keys.onEscapePressed: detailRoot.startClose() Connections { target: GamepadManager function onBackPressed() { - if (detailRoot.visible) detailRoot.close() + if (detailRoot.visible) detailRoot.startClose() } function onSelectPressed() { if (detailRoot.visible) detailRoot.launch() @@ -364,16 +373,32 @@ Item { } } - NumberAnimation on opacity { + NumberAnimation { id: fadeIn - running: detailRoot.visible + target: detailRoot + property: "opacity" from: 0; to: 1 duration: 220 easing.type: Easing.OutCubic } + NumberAnimation { + id: fadeOut + target: detailRoot + property: "opacity" + from: 1; to: 0 + duration: 160 + easing.type: Easing.InCubic + onStopped: { + detailRoot.isClosing = false + detailRoot.close() + } + } + onVisibleChanged: { - if (visible) { + if (visible && !isClosing) { + detailRoot.opacity = 0 + fadeIn.start() Qt.callLater(function() { playBtn.forceActiveFocus() }) } }