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 required property var taskSwitcher
readonly property var taskSwitcherState: taskSwitcher.taskSwitcherState readonly property var taskSwitcherState: taskSwitcher.taskSwitcherState
opacity: taskSwitcherState.wasInActiveTask ? 1 : Math.min(1, taskSwitcherState.yPosition / taskSwitcherState.openedYPosition)
transform: Scale { transform: Scale {
origin.x: root.width / 2 origin.x: root.width / 2
origin.y: root.height / 2 origin.y: root.height / 2

View file

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

View file

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