taskswitcher: invert tasks ordering

This commit is contained in:
Yari Polla 2022-04-28 21:37:47 +02:00
parent 174843767f
commit d75e8b6f78
2 changed files with 6 additions and 6 deletions

View file

@ -87,7 +87,7 @@ Item {
if (taskSwitcherState.wasInActiveTask) { if (taskSwitcherState.wasInActiveTask) {
taskSwitcherState.goToTaskIndex(tasksModel.activeTask.row); taskSwitcherState.goToTaskIndex(tasksModel.activeTask.row);
} else { } else {
taskSwitcherState.goToTaskIndex(tasksCount - 1); taskSwitcherState.goToTaskIndex(0);
} }
// show task switcher, hide all running apps // show task switcher, hide all running apps

View file

@ -27,7 +27,7 @@ QtObject {
// //
// xPosition: // xPosition:
// We start at 0, which is the position at which the first task in the task switcher is centered on the screen. // We start at 0, which is the position at which the first task in the task switcher is centered on the screen.
// Increasing xPosition results in the task switcher moving forward (to the second task, third task, etc). // Decreasing xPosition results in the task switcher moving forward (to the second task, third task, etc), being the layout direction Right to Left.
// //
// yPosition: // yPosition:
// 0 - Start of swipe up gesture, if window was showing, the thumbnail is the size of it // 0 - Start of swipe up gesture, if window was showing, the thumbnail is the size of it
@ -43,7 +43,7 @@ QtObject {
property real oldXPosition: 0 property real oldXPosition: 0
property real oldYPosition: 0 property real oldYPosition: 0
onXPositionChanged: { onXPositionChanged: {
movingRight = xPosition > oldXPosition; movingRight = xPosition < oldXPosition;
oldXPosition = xPosition; oldXPosition = xPosition;
} }
onYPositionChanged: { onYPositionChanged: {
@ -63,7 +63,7 @@ QtObject {
property bool currentlyBeingOpened: false property bool currentlyBeingOpened: false
readonly property int currentTaskIndex: { readonly property int currentTaskIndex: {
let candidateIndex = Math.round(xPosition / (taskSpacing + taskWidth)); let candidateIndex = Math.round(-xPosition / (taskSpacing + taskWidth));
return Math.max(0, Math.min(taskSwitcher.tasksCount - 1, candidateIndex)); return Math.max(0, Math.min(taskSwitcher.tasksCount - 1, candidateIndex));
} }
@ -139,7 +139,7 @@ QtObject {
// get the xPosition where the task will be centered on the screen // get the xPosition where the task will be centered on the screen
function xPositionFromTaskIndex(index) { function xPositionFromTaskIndex(index) {
return index * (taskWidth + taskSpacing); return -index * (taskWidth + taskSpacing);
} }
// instantly go to the task index // instantly go to the task index
@ -173,7 +173,7 @@ QtObject {
animateGoToTaskIndex(currentTaskIndex, duration); animateGoToTaskIndex(currentTaskIndex, duration);
} else { } else {
let currentTaskIndexPosition = xPositionFromTaskIndex(currentTaskIndex); let currentTaskIndexPosition = xPositionFromTaskIndex(currentTaskIndex);
if (xPosition < currentTaskIndexPosition) { if (xPosition > currentTaskIndexPosition) {
if (movingRight) { if (movingRight) {
animateGoToTaskIndex(currentTaskIndex, duration); animateGoToTaskIndex(currentTaskIndex, duration);
} else { } else {