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() }) } }