taskswitcher: Fix animations when opening from homescreen

This commit is contained in:
Devin Lin 2022-04-11 17:14:35 -04:00
parent 7871212461
commit 4e95a4abc3
3 changed files with 14 additions and 5 deletions

View file

@ -19,8 +19,6 @@ Item {
required property var taskSwitcher
readonly property var taskSwitcherState: taskSwitcher.taskSwitcherState
opacity: taskSwitcherState.wasInActiveTask ? 1 : Math.min(1, taskSwitcherState.yPosition / taskSwitcherState.openedYPosition)
transform: Scale {
origin.x: root.width / 2
origin.y: root.height / 2

View file

@ -163,8 +163,8 @@ Item {
anchors.fill: parent
color: {
// animate background colour only if opening from the homescreen
if (taskSwitcherState.wasInActiveTask) {
// animate background colour only if we are *not* opening from the homescreen
if (taskSwitcherState.wasInActiveTask || !taskSwitcherState.currentlyBeingOpened) {
return Qt.rgba(0, 0, 0, 0.6);
} else {
return Qt.rgba(0, 0, 0, 0.6 * Math.min(1, taskSwitcherState.yPosition / taskSwitcherState.openedYPosition));
@ -190,6 +190,16 @@ Item {
// the item is effectively anchored to the flickable bounds
TaskList {
taskSwitcher: root
opacity: {
// animate opacity only if we are *not* opening from the homescreen
if (taskSwitcherState.wasInActiveTask || !taskSwitcherState.currentlyBeingOpened) {
return 1;
} else {
Math.min(1, taskSwitcherState.yPosition / taskSwitcherState.openedYPosition);
}
}
x: flickable.contentX
width: flickable.width
height: flickable.height

View file

@ -106,6 +106,7 @@ QtObject {
let subtract = (maxScale - 1) * (yPosition / openedYPosition);
let finalScale = Math.max(0, Math.min(maxScale, maxScale - subtract));
// animate scale only if we are *not* opening from the homescreen
if (wasInActiveTask || !currentlyBeingOpened) {
return finalScale;
}
@ -200,7 +201,7 @@ QtObject {
target: root
property: "yPosition"
to: openedYPosition
duration: PlasmaCore.Units.longDuration * 2
duration: 300
easing.type: Easing.OutBack
onFinished: {