make quick switch gesture properly open switcher on end of list

doing a quick task switch gesture towards the end of the list should force open the task switcher (there is nothing to switch to)
this was half-done on the left side of the switcher (this behavior is not visible with immediate task reordering, but could be hit if we have different ordering criteria or delayed reordering)
and due to superfluous Math.max completely not working on the right side always opening the right-most task instead of opening the switcher
This commit is contained in:
Luis Büchi 2024-07-07 23:57:48 +02:00
parent 4cec95a3cc
commit 7852b7ad2b

View file

@ -156,13 +156,14 @@ FocusScope {
let shouldSwitch = false;
if (state.xVelocity > 0 && state.wasInActiveTask) {
// flick to the right, go to app to the left
newIndex = state.currentTaskIndex + 1, tasksCount - 1;
newIndex = state.currentTaskIndex + 1;
if (newIndex < tasksCount) {
// switch only if flick doesn't go over end of list
shouldSwitch = true;
}
} else if (state.xVelocity < 0 && state.wasInActiveTask) {
newIndex = Math.max(state.currentTaskIndex - 1, 0);
// flick to the left, go to app to the right
newIndex = state.currentTaskIndex - 1;
if (newIndex >= 0) {
// switch only if flick doesn't go over end of list
shouldSwitch = true;