actiondrawer: Added the Over-Scroll Effect to all Portrait Mode Quick Settings States

Brought the over-scroll effect found in the pinned quick settings panel to all the portrait mode quick settings states.
This helps improve the user experience while also bringing more consistency when pulling down the panel.

![over-scroll](/uploads/a8531b6fb51fde6fc7dc9c9647945899/over-scroll.gif)
This commit is contained in:
Micah Stanley 2024-06-22 04:50:09 +00:00 committed by Devin Lin
parent 7cf84548c6
commit 600fd05900

View file

@ -72,15 +72,20 @@ Item {
addedHeight: {
if (!actionDrawer.openToPinnedMode) {
// if pinned mode disabled, just go to full height
return quickSettings.maxAddedHeight;
let progress = (root.actionDrawer.offset - maximizedQuickSettingsOffset) / (quickSettings.maxAddedHeight * 4);
let effectProgress = Math.atan(Math.max(0, progress));
return (quickSettings.maxAddedHeight * effectProgress) + quickSettings.maxAddedHeight;
} else if (!actionDrawer.opened) {
// over-scroll effect for initial opening
let progress = (root.actionDrawer.offset - minimizedQuickSettingsOffset) / quickSettings.maxAddedHeight;
let effectProgress = Math.atan(Math.max(0, progress));
return quickSettings.maxAddedHeight * 0.25 * effectProgress;
} else {
// over-scroll effect for full drawer
let progress = (root.actionDrawer.offset - maximizedQuickSettingsOffset) / (quickSettings.maxAddedHeight * 4);
let effectProgress = Math.atan(Math.max(0, progress));
// as the drawer opens, add height to the rectangle, revealing content
return Math.max(0, Math.min(quickSettings.maxAddedHeight, root.actionDrawer.offset - minimizedQuickSettingsOffset));
return (quickSettings.maxAddedHeight * effectProgress) + Math.max(0, Math.min(quickSettings.maxAddedHeight, root.actionDrawer.offset - minimizedQuickSettingsOffset));
}
}