From 61227abaeb814dd6f10b756849fd44cb90215112 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Mon, 5 Feb 2018 22:11:20 +0200 Subject: [PATCH] ALWAYS Restore Task Animation --VERY IMPORTANT CODE, fixes a bug when cycling the mouse very fast inside and outside the dock, in some rare cases the restoreAnimation didnt end!! --- .../package/contents/ui/applet/AppletItem.qml | 10 +-- containment/package/contents/ui/main.qml | 6 +- .../package/contents/ui/task/TaskDelegate.qml | 12 ++-- .../task/animations/TaskRestoreAnimation.qml | 65 ++++++++++++------- 4 files changed, 60 insertions(+), 33 deletions(-) diff --git a/containment/package/contents/ui/applet/AppletItem.qml b/containment/package/contents/ui/applet/AppletItem.qml index 20d38bada..0c25e1f52 100644 --- a/containment/package/contents/ui/applet/AppletItem.qml +++ b/containment/package/contents/ui/applet/AppletItem.qml @@ -216,10 +216,12 @@ Item { //outside the LatteApplet Plasmoid //property int debCounter: 0; function clearZoom(){ - if (root.globalDirectRender){ - wrapper.zoomScale = 1; - } else { - restoreAnimation.start(); + if (layoutsContainer.hoveredIndex === -1) { + if (root.globalDirectRender){ + wrapper.zoomScale = 1; + } else { + restoreAnimation.start(); + } } } diff --git a/containment/package/contents/ui/main.qml b/containment/package/contents/ui/main.qml index f7312f9ac..30484bb70 100644 --- a/containment/package/contents/ui/main.qml +++ b/containment/package/contents/ui/main.qml @@ -881,9 +881,6 @@ DragDrop.DropArea { } function clearZoom(){ - //layoutsContainer.currentSpot = -1000; - //layoutsContainer.hoveredIndex = -1; - if (latteApplet){ latteApplet.clearZoom(); } @@ -1091,6 +1088,8 @@ DragDrop.DropArea { if (value === true) { if (dockContainsMouse && !rootMouseArea.containsMouse) { root.globalDirectRender = true; + } else { + // console.log("direct render true ignored..."); } } else { root.globalDirectRender = false; @@ -1541,6 +1540,7 @@ DragDrop.DropArea { enableDirectRenderTimer.stop(); setGlobalDirectRender(false); + root.initializeHoveredIndexes(); root.clearZoom(); } diff --git a/plasmoid/package/contents/ui/task/TaskDelegate.qml b/plasmoid/package/contents/ui/task/TaskDelegate.qml index 745e56ee7..f8db5d3bc 100644 --- a/plasmoid/package/contents/ui/task/TaskDelegate.qml +++ b/plasmoid/package/contents/ui/task/TaskDelegate.qml @@ -326,9 +326,8 @@ MouseArea{ onGlobalDirectRenderChanged:{ if (root.globalDirectRender && restoreAnimation.running) { - // console.log("CLEAR TASK SCALE !!!!"); + // console.log("Cleat Task Scale !!!!"); restoreAnimation.stop(); - wrapper.mScale = 1; } } } @@ -812,8 +811,13 @@ MouseArea{ if (root.globalDirectRender) wrapper.mScale = 1; - else if (!inAttentionAnimation && !inFastRestoreAnimation && !inMimicParabolicAnimation) - restoreAnimation.start(); + else if (!inAttentionAnimation && !inFastRestoreAnimation && !inMimicParabolicAnimation){ + if (icList.hoveredIndex === -1) { + restoreAnimation.start(); + } else { + console.log("Clear zoom signal ignored..."); + } + } } function handlerDraggingFinished(){ diff --git a/plasmoid/package/contents/ui/task/animations/TaskRestoreAnimation.qml b/plasmoid/package/contents/ui/task/animations/TaskRestoreAnimation.qml index 64874d7dd..2657fb878 100644 --- a/plasmoid/package/contents/ui/task/animations/TaskRestoreAnimation.qml +++ b/plasmoid/package/contents/ui/task/animations/TaskRestoreAnimation.qml @@ -23,34 +23,55 @@ import QtQuick 2.0 import org.kde.plasma.plasmoid 2.0 ///////Restore Zoom Animation///// -ParallelAnimation{ +SequentialAnimation{ id: restoreAnimation - PropertyAnimation { - target: wrapper - property: "mScale" - to: 1 - duration: 4 * mainItemContainer.animationTime - easing.type: Easing.InCubic - } + ParallelAnimation{ + PropertyAnimation { + target: wrapper + property: "mScale" + to: 1 + duration: 4 * mainItemContainer.animationTime + easing.type: Easing.InCubic + } - PropertyAnimation { - target: hiddenSpacerLeft - property: "nScale" - to: 0 - duration: 4 * mainItemContainer.animationTime - easing.type: Easing.InCubic - } + PropertyAnimation { + target: hiddenSpacerLeft + property: "nScale" + to: 0 + duration: 4 * mainItemContainer.animationTime + easing.type: Easing.InCubic + } - PropertyAnimation { - target: hiddenSpacerRight - property: "nScale" - to: 0 - duration: 4 * mainItemContainer.animationTime - easing.type: Easing.InCubic + PropertyAnimation { + target: hiddenSpacerRight + property: "nScale" + to: 0 + duration: 4 * mainItemContainer.animationTime + easing.type: Easing.InCubic + } + } + //! debug code based on third task + /*ScriptAction{ + script: { + if (index===2) { + console.log("restore script ended correctly..."); + } + } } onStarted: { - // console.log("restore animation started..."); + if (index === 2) + console.log("restore animation started..."); + } */ + + onStopped: { + //! VERY IMPORTANT CODE, fixes a bug when cycling the mouse very fast inside + //! and outside the dock, in some rare cases the restoreAnimation didnt end!! + if (latteDock && (!latteDock.dockContainsMouse || icList.hoveredIndex === -1)) { + wrapper.mScale = 1; + } + // if (index === 2) + // console.log("restore animation stopped... ind:"+index+" zoom:"+wrapper.mScale); } }