mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
make taskswitcher preview reluctant to track far finger moves
the further up the finger in the gesture activation goes, the less direct the tracking is. fixes the last part of https://invent.kde.org/plasma/plasma-mobile/-/issues/368
This commit is contained in:
parent
bd41e5bd41
commit
9e8f0a0c74
1 changed files with 17 additions and 1 deletions
|
|
@ -32,7 +32,23 @@ MouseArea {
|
||||||
|
|
||||||
return baseY + diff / 2 - shellTopMargin - trackFingerYOffset;
|
return baseY + diff / 2 - shellTopMargin - trackFingerYOffset;
|
||||||
}
|
}
|
||||||
readonly property real trackFingerYOffset: taskSwitcherHelpers.isScaleClamped ? taskSwitcherState.yPosition - taskSwitcherHelpers.openedYPosition : 0
|
readonly property real trackFingerYOffset: {
|
||||||
|
if (taskSwitcherHelpers.isScaleClamped) {
|
||||||
|
let openedPos = taskSwitcherHelpers.openedYPosition;
|
||||||
|
let directTrackingOffset = openedPos * 0.2
|
||||||
|
if (taskSwitcherState.yPosition < openedPos + directTrackingOffset) {
|
||||||
|
// Allow the task list to move further up than the fully opened position
|
||||||
|
return taskSwitcherState.yPosition - openedPos;
|
||||||
|
} else {
|
||||||
|
// but make it more reluctant the further up it goes
|
||||||
|
let overDragProgress = (taskSwitcherState.yPosition - directTrackingOffset - openedPos) / openedPos;
|
||||||
|
// Base formula is 1-2.3^(-progress) which asymptotically approaches 1
|
||||||
|
return (1 - Math.pow(2.3, -overDragProgress)) * openedPos + directTrackingOffset;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getTaskAt(index) {
|
function getTaskAt(index) {
|
||||||
return repeater.itemAt(index);
|
return repeater.itemAt(index);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue