diff --git a/components/mobileshell/qml/actiondrawer/ActionDrawer.qml b/components/mobileshell/qml/actiondrawer/ActionDrawer.qml index 51e21573..d805b757 100644 --- a/components/mobileshell/qml/actiondrawer/ActionDrawer.qml +++ b/components/mobileshell/qml/actiondrawer/ActionDrawer.qml @@ -10,6 +10,7 @@ import QtQuick.Controls 2.15 import QtQuick.Layouts 1.1 import QtQuick.Window 2.2 +import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.private.nanoshell 2.0 as NanoShell import org.kde.plasma.private.mobileshell as MobileShell @@ -272,15 +273,35 @@ Item { mode: MobileShell.SwipeArea.VerticalOnly anchors.fill: parent - function startSwipe() { + + function startSwipeWithPoint(point) { root.cancelAnimations(); root.dragging = true; // Immediately open action drawer if we interact with it and it's already open // This allows us to have 2 quick flicks from minimized -> expanded - if (root.visible && !root.opened) { + if (root.intendedToBeVisible && !root.opened) { root.opened = true; } + + // if the user swiped from the top left, otherwise it's from the top right + if (!root.intendedToBeVisible) { + if (point.x < root.width / 2) { + root.openToPinnedMode = ShellSettings.Settings.actionDrawerTopLeftMode == ShellSettings.Settings.Pinned; + } else { + root.openToPinnedMode = ShellSettings.Settings.actionDrawerTopRightMode == ShellSettings.Settings.Pinned; + } + + if (root.intendedToBeVisible) { + // ensure the action drawer state is consistent + root.closeImmediately(); + } + + actionDrawer.offset = 0; + actionDrawer.oldOffset = 0; + + intendedToBeVisible = true; + } } function endSwipe() { @@ -292,7 +313,7 @@ Item { root.offset += deltaY; } - onSwipeStarted: startSwipe() + onSwipeStarted: (point) => startSwipeWithPoint(point) onSwipeEnded: endSwipe() onSwipeMove: (totalDeltaX, totalDeltaY, deltaX, deltaY) => moveSwipe(totalDeltaX, totalDeltaY, deltaX, deltaY) @@ -304,6 +325,8 @@ Item { id: contentContainer anchors.fill: parent + opacity: root.opened || swipeArea.moving || drawerAnimation.running || root.offset > 0 || root.intendedToBeVisible ? 1 : 0 + actionDrawer: root quickSettingsModel: root.quickSettingsModel } diff --git a/components/mobileshell/qml/actiondrawer/ActionDrawerWindow.qml b/components/mobileshell/qml/actiondrawer/ActionDrawerWindow.qml index c191e689..9feaaa44 100644 --- a/components/mobileshell/qml/actiondrawer/ActionDrawerWindow.qml +++ b/components/mobileshell/qml/actiondrawer/ActionDrawerWindow.qml @@ -9,6 +9,7 @@ import QtQuick.Controls 2.15 import QtQuick.Layouts 1.1 import QtQuick.Window +import org.kde.plasma.private.mobileshell as MobileShell import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.private.nanoshell 2.0 as NanoShell import org.kde.layershell 1.0 as LayerShell @@ -32,17 +33,28 @@ Window { * The ActionDrawer component. */ property alias actionDrawer: drawer + property alias intendedToBeVisible: drawer.intendedToBeVisible + property alias state: drawer.state - visible: drawer.intendedToBeVisible + visible: true color: "transparent" - onVisibleChanged: { - if (visible) { + Component.onCompleted: updateTouchArea() + + function updateTouchArea() { + if (state != "" && state != "close") { window.raise(); + ShellUtil.setInputRegion(window, Qt.rect(0, 0, 0, 0)); + } else { + ShellUtil.setInputRegion(window, Qt.rect(0, 0, window.width, MobileShell.Constants.topPanelHeight)); } } + onWidthChanged: updateTouchArea() + onIntendedToBeVisibleChanged: updateTouchArea() + onStateChanged: updateTouchArea() + onActiveChanged: { if (!active) { drawer.close(); diff --git a/containments/panel/package/contents/ui/main.qml b/containments/panel/package/contents/ui/main.qml index ba10b60c..50e28de3 100644 --- a/containments/panel/package/contents/ui/main.qml +++ b/containments/panel/package/contents/ui/main.qml @@ -122,13 +122,6 @@ ContainmentItem { backgroundColor: !root.showingApp ? "transparent" : root.backgroundColor } - // swiping area for swipe-down drawer - MobileShell.ActionDrawerOpenSurface { - id: swipeArea - actionDrawer: drawer.actionDrawer - anchors.fill: parent - } - // swipe-down drawer component MobileShell.ActionDrawerWindow { id: drawer