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
This commit is contained in:
Devin Lin 2021-02-22 16:08:43 +00:00 committed by Bhushan Shah
parent 40f6abd78e
commit 7a740a2f5d

View file

@ -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