From 15e44688349d1782a4b818f12274c9693f1db516 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Sun, 21 Jun 2015 12:26:14 -0700 Subject: [PATCH] animation on close --- .../taskpanel/package/contents/ui/Task.qml | 24 ++++++++++++++----- .../package/contents/ui/TaskSwitcher.qml | 7 ++++++ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/containments/taskpanel/package/contents/ui/Task.qml b/containments/taskpanel/package/contents/ui/Task.qml index 3b7e6fca..0c8d310c 100644 --- a/containments/taskpanel/package/contents/ui/Task.qml +++ b/containments/taskpanel/package/contents/ui/Task.qml @@ -35,12 +35,23 @@ Item { fill: parent margins: units.gridUnit } - NumberAnimation { + SequentialAnimation { id: slideAnim - target: background - properties: "x" - duration: units.longDuration - easing.type: Easing.InOutQuad + property alias to: internalSlideAnim.to + NumberAnimation { + id: internalSlideAnim + target: background + properties: "x" + duration: units.longDuration + easing.type: Easing.InOutQuad + } + ScriptAction { + script: { + if (background.x != 0) { + backend.closeByItemId(model.Id); + } + } + } } Rectangle { id: background @@ -79,7 +90,8 @@ Item { onReleased: { delegate.z = 0; if (Math.abs(background.x) > background.width/2) { - backend.closeByItemId(model.Id); + slideAnim.to = background.x > 0 ? background.width*2 : -background.width*2; + slideAnim.running = true; } else { slideAnim.to = 0; slideAnim.running = true; diff --git a/containments/taskpanel/package/contents/ui/TaskSwitcher.qml b/containments/taskpanel/package/contents/ui/TaskSwitcher.qml index 55b5dbdf..23ca465c 100644 --- a/containments/taskpanel/package/contents/ui/TaskSwitcher.qml +++ b/containments/taskpanel/package/contents/ui/TaskSwitcher.qml @@ -121,5 +121,12 @@ FullScreenPanel { height: window.height } delegate: Task {} + displaced: Transition { + NumberAnimation { + properties: "x,y" + duration: units.longDuration + easing.type: Easing.InOutQuad + } + } } }