From 7a740a2f5d97f26575fb449b8c8ebb83f21dc6fb Mon Sep 17 00:00:00 2001 From: Devin Lin Date: Mon, 22 Feb 2021 16:08:43 +0000 Subject: [PATCH] Tweak app drawer behavior - Only trigger the app drawer open/close animation if the flick goes over an eighth of the screen so that small flicks do not trigger it - Adjust easing curve to be OutQuad so that fast flicks don't feel slow (have to slow to a stop, and then animation triggers) - Increase animation duration to account for OutQuad curve - Animate opacity of application icons as the app drawer comes in and out --- .../contents/ui/launcher/AppDrawer.qml | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/containments/homescreen/package/contents/ui/launcher/AppDrawer.qml b/containments/homescreen/package/contents/ui/launcher/AppDrawer.qml index 6e7e2ee5..ed6508b7 100644 --- a/containments/homescreen/package/contents/ui/launcher/AppDrawer.qml +++ b/containments/homescreen/package/contents/ui/launcher/AppDrawer.qml @@ -98,9 +98,17 @@ Item { } if (view.movementDirection === AppDrawer.MovementDirection.Up) { - open(); + if (view.contentY > 7 * -view.height / 8) { // over one eighth of the screen + open(); + } else { + close(); + } } else { - close(); + if (view.contentY < -view.height / 8) { // over one eighth of the screen + close(); + } else { + open(); + } } } @@ -116,8 +124,9 @@ Item { id: scrollAnim target: view properties: "contentY" - duration: units.longDuration - easing.type: Easing.InOutQuad + duration: units.longDuration * 2 + easing.type: Easing.OutQuad + easing.amplitude: 2.0 } PC3.Label { @@ -170,6 +179,16 @@ Item { bottomMargin: root.bottomPadding } + opacity: { + if (root.status == AppDrawer.Status.Open) { + return 1; + } else if (root.status == AppDrawer.Status.Closed) { + return 0; + } else { // peeking + return (1 - view.contentY / -view.height); + } + } + visible: root.status !== AppDrawer.Status.Closed cellWidth: view.width / Math.floor(view.width / ((root.availableCellHeight - root.reservedSpaceForLabel) + units.smallSpacing*4)) cellHeight: root.availableCellHeight