new close anim

This commit is contained in:
Marco Martin 2020-07-30 17:53:55 +02:00
parent a1b7ef5d36
commit 8f39bd3828
2 changed files with 40 additions and 7 deletions

View file

@ -132,8 +132,8 @@ Item {
} }
onPressed: delegate.z = 10; onPressed: delegate.z = 10;
onClicked: { onClicked: {
window.hide(); //window.hide();
window.setSingleActiveWindow(model.index); window.setSingleActiveWindow(model.index, delegate);
} }
onReleased: { onReleased: {
delegate.z = 0; delegate.z = 0;

View file

@ -78,7 +78,7 @@ NanoShell.FullScreenOverlay {
scrollAnim.restart(); scrollAnim.restart();
} }
function setSingleActiveWindow(id) { function setSingleActiveWindow(id, delegate) {
if (id < 0) { if (id < 0) {
return; return;
} }
@ -90,6 +90,8 @@ NanoShell.FullScreenOverlay {
tasksModel.requestToggleMinimized(idx); tasksModel.requestToggleMinimized(idx);
} }
} }
activateAnim.delegate = delegate;
activateAnim.restart();
} }
onOffsetChanged: tasksView.contentY = offset + grid.y onOffsetChanged: tasksView.contentY = offset + grid.y
@ -116,10 +118,41 @@ NanoShell.FullScreenOverlay {
} }
ScriptAction { ScriptAction {
script: { script: {
if (tasksView.contentY <= 0 || tasksView.contentY >= tasksView.contentHeight - window.height) { window.visible = false;
window.visible = false; }
setSingleActiveWindow(currentTaskIndex); }
} }
SequentialAnimation {
id: activateAnim
property Item delegate
ScriptAction {
script: {
activateAnim.delegate.z = 2;
}
}
ParallelAnimation {
OpacityAnimator {
target: window.contentItem
from: 1
to: 0
duration: units.longDuration
easing.type: Easing.InOutQuad
}
ScaleAnimator {
target: activateAnim.delegate
from: 1
to: 2
duration: units.longDuration
easing.type: Easing.InOutQuad
}
}
ScriptAction {
script: {
window.visible = false;
activateAnim.delegate.z = 0;
activateAnim.delegate.scale = 1;
window.contentItem.opacity = 1
} }
} }
} }