actiondrawer: add ability to open and expand quicksettings with one stroke

This commit is contained in:
Yari Polla 2022-05-25 03:03:21 +02:00
parent 2c61bb1723
commit fb8494fec4
2 changed files with 13 additions and 0 deletions

View file

@ -55,6 +55,11 @@ Item {
*/ */
property bool opened: false property bool opened: false
/**
* Whether the panel can be opened with one stroke.
*/
property bool expandable: false
/** /**
* Direction the panel is currently moving in. * Direction the panel is currently moving in.
*/ */
@ -108,6 +113,11 @@ Item {
if (offset < 0) { if (offset < 0) {
offset = 0; offset = 0;
} }
if (offset >= contentContainerLoader.minimizedQuickSettingsOffset && expandable) {
root.opened = true;
}
root.direction = (oldOffset === offset) root.direction = (oldOffset === offset)
? MobileShell.Direction.None ? MobileShell.Direction.None
: (offset > oldOffset ? MobileShell.Direction.Down : MobileShell.Direction.Up); : (offset > oldOffset ? MobileShell.Direction.Down : MobileShell.Direction.Up);

View file

@ -43,6 +43,9 @@ MouseArea {
anchors.fill: parent anchors.fill: parent
onPressed: { onPressed: {
oldMouseY = mouse.y; oldMouseY = mouse.y;
actionDrawer.expandable = mouse.x < root.width/2 ? true : false;
startSwipe(); startSwipe();
} }
onReleased: endSwipe() onReleased: endSwipe()