taskswitcher: Fix vertical swipe being overridden by side swipe

This commit is contained in:
Devin Lin 2023-03-31 20:32:56 -07:00
parent afbbe013a5
commit 7b77c9072f
4 changed files with 17 additions and 3 deletions

View file

@ -25,7 +25,13 @@ Item {
readonly property real dragOffset: -control.y
// whether this task is being interacted with
readonly property bool interactingActive: control.pressed && control.passedDragThreshold
// whether to show the text header
property bool showHeader: true
// the amount to darken the task preview by
property real darken: 0
opacity: 1 - dragOffset / taskSwitcher.height
@ -88,7 +94,6 @@ Item {
// set threshold
if (!passedDragThreshold && Math.abs(y) > dragThreshold) {
passedDragThreshold = true;
// TODO: request that FlickContainer be not interactive (so we don't change position in list while swiping up)
}
// update position

View file

@ -19,6 +19,8 @@ MouseArea {
required property var taskSwitcher
readonly property var taskSwitcherState: taskSwitcher.taskSwitcherState
property int taskInteractingCount: 0
// account for system header and footer offset (center the preview image)
readonly property real taskY: {
let headerHeight = shellTopMargin;
@ -95,7 +97,6 @@ MouseArea {
// this is the x-position with respect to the list
property real listX: taskSwitcherState.xPositionFromTaskIndex(currentIndex);
Behavior on listX {
NumberAnimation {
duration: PlasmaCore.Units.longDuration
@ -120,6 +121,12 @@ MouseArea {
return Math.max(0, upperBoundAdjust);
}
// update count of tasks being interacted with, so we know whether we are in a swipe up action
onInteractingActiveChanged: {
let offset = interactingActive ? 1 : -1;
taskInteractingCount = Math.max(0, taskInteractingCount + offset);
}
width: taskSwitcherState.taskWidth
height: taskSwitcherState.taskHeight
previewWidth: taskSwitcherState.previewWidth

View file

@ -196,6 +196,9 @@ FocusScope {
taskSwitcherState: root.taskSwitcherState
// don't allow FlickContainer to steal from swiping on tasks
interactive: taskList.taskInteractingCount === 0
// the item is effectively anchored to the flickable bounds
TaskList {
id: taskList

View file

@ -24,7 +24,6 @@ QtObject {
signal unlockFailed()
function tryPassword() {
console.log('try')
if (root.password !== '') { // prevent typing lock when password is empty
waitingForAuth = true;
}