diff --git a/src/qml/FooterBar.qml b/src/qml/FooterBar.qml index c5b33731..f31ed664 100644 --- a/src/qml/FooterBar.qml +++ b/src/qml/FooterBar.qml @@ -1,4 +1,5 @@ /** + * SPDX-FileCopyrightText: 2020 Devin Lin * SPDX-FileCopyrightText: 2021 Bart De Vries * * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL @@ -48,25 +49,40 @@ Flickable { toClose.stop(); propagateComposedEvents = true; } - onReleased: footerBar.resetToBounds() + onReleased: footerBar.resetToBoundsOnFlick() } - function resetToBounds() { - if (!atYBeginning && !atYEnd) { + function resetToBoundsOnFlick() { + if (!atYBeginning || !atYEnd) { if (footerBar.verticalVelocity > 0) { toOpen.restart(); } else if (footerBar.verticalVelocity < 0) { toClose.restart(); + } else { // i.e. when verticalVelocity === 0 + if (contentY > contentHeight / 4) { + toOpen.restart(); + } else { + toClose.restart(); + } } } } + function resetToBoundsOnResize() { + if (contentY > contentHeight / 4) { + contentY = contentHeight / 2; + } else { + contentY = 0; + } + } + onMovementStarted: { toOpen.stop(); toClose.stop(); } - onFlickStarted: resetToBounds() - onMovementEnded: resetToBounds() + onFlickStarted: resetToBoundsOnFlick() + onMovementEnded: resetToBoundsOnFlick() + onHeightChanged: resetToBoundsOnResize() Item { id: background