From 6fb56f90b1bda9456ec647e0fca7bbc7268f0e6c Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Thu, 4 May 2017 22:33:52 +0300 Subject: [PATCH] fix #431,support again the internal separator --support again the internal separator based on the new signaling for the parabolic effect --- containment/contents/ui/AppletItem.qml | 90 ++++++++++++++----- plasmoid/contents/ui/TaskDelegate.qml | 87 +++++++++++++----- shell/contents/configuration/TweaksConfig.qml | 2 +- 3 files changed, 132 insertions(+), 47 deletions(-) diff --git a/containment/contents/ui/AppletItem.qml b/containment/contents/ui/AppletItem.qml index c5efa7f3a..59805e550 100644 --- a/containment/contents/ui/AppletItem.qml +++ b/containment/contents/ui/AppletItem.qml @@ -847,6 +847,23 @@ Item { NumberAnimation { duration: container.directAnimationTime } } + //!this is used in order to update the index when the signal is for the internal latte plasmoid + function updateIdSendScale(indx, zScale, zStep){ + if(root.latteApplet && ((index=root.latteAppletPos) + || (index>root.latteAppletPos && indx<=root.latteAppletPos)) ){ + var appStep = Math.abs(root.latteAppletPos-index); + var signalStep = Math.abs(indx - index); + + if(indexroot.latteAppletPos){ + root.latteApplet.updateScale(root.tasksCount-1 - (signalStep-appStep), zScale,zStep); + } + } else { + root.updateScale(indx, zScale, zStep); + } + } + function calculateScales( currentMousePosition ){ if (root.editMode || root.zoomFactor===1 || root.durationTime===0) { @@ -892,33 +909,58 @@ Item { leftScale = bigNeighbourZoom; } - // console.log("--------------") - // console.debug(leftScale + " " + rightScale + " " + index); - //activate messages to update the the neighbour scales - if(root.latteApplet && index===root.latteAppletPos+1) - root.latteApplet.updateScale(root.tasksCount-1, leftScale, 0); - else - root.updateScale(index-1, leftScale, 0); - - if(root.latteApplet && index===root.latteAppletPos-1) - root.latteApplet.updateScale(0, rightScale, 0); - else - root.updateScale(index+1, rightScale, 0); + //! compute the neighbour separator scales + var bsNeighbourZoom = 1; + var ssNeighbourZoom = 1; + if(root.latteApplet && root.latteApplet.internalSeparatorPos>=0) { + var latApp = root.latteApplet; + if((latApp.internalSeparatorPos === 0) || (latApp.internalSeparatorPos === root.tasksCount-1) ){ + var sepZoomDifference = (5+root.iconMargin) / root.realSize; - if(root.latteApplet && index===root.latteAppletPos+1) - root.latteApplet.updateScale(root.tasksCount-2, 1, 0); - else if (root.latteApplet && index===root.latteAppletPos+2) - root.latteApplet.updateScale(root.tasksCount-1, 1, 0); - else - root.updateScale(index-2, 1, 0); + bsNeighbourZoom = Math.max(1,bigNeighbourZoom - sepZoomDifference); + ssNeighbourZoom = Math.max(1,smallNeighbourZoom - sepZoomDifference); + } + } - if(root.latteApplet && index===root.latteAppletPos-1) - root.latteApplet.updateScale(1, 1, 0); - else if (root.latteApplet && index===root.latteAppletPos-2) - root.latteApplet.updateScale(0, 1, 0); - else - root.updateScale(index+2, 1 ,0); + if(!root.latteApplet || Math.abs(root.latteAppletPos-index)>1 + || (root.hasInternalSeparator + && ((root.latteApplet.internalSeparatorPos>0 && root.latteApplet.internalSeparatorPosroot.latteAppletPos) + || (root.latteApplet.internalSeparatorPos===root.tasksCount-1 && index 2){ root.latteApplet.clearZoom(); diff --git a/plasmoid/contents/ui/TaskDelegate.qml b/plasmoid/contents/ui/TaskDelegate.qml index db7e92ad3..96cbc7b5d 100644 --- a/plasmoid/contents/ui/TaskDelegate.qml +++ b/plasmoid/contents/ui/TaskDelegate.qml @@ -358,6 +358,8 @@ MouseArea{ property real regulatorWidth: mainItemContainer.isSeparator ? separatorRegWidth : basicScalingWidth; property real regulatorHeight: mainItemContainer.isSeparator ? separatorRegHeight : basicScalingHeight; + property int separatorRegLength: root.vertical ? separatorRegWidth : separatorRegHeight + property real separatorRegWidth: { if (!mainItemContainer.isSeparator) return; @@ -444,6 +446,24 @@ MouseArea{ }//Flow + //!this is used in order to update the index when the signal is for applets + //!outside the latte plasmoid + function updateIdSendScale(indx, zScale, zStep){ + if ((indx>=0 && indx<=root.tasksCount-1) || (!root.latteDock)){ + root.updateScale(indx, zScale, zStep); + } else{ + var appletId = latteDock.latteAppletPos; + if (indx<0) + appletId = latteDock.latteAppletPos + indx; + else if (indx>root.tasksCount-1){ + var step=indx-root.tasksCount+1; + appletId = latteDock.latteAppletPos + step; + } + + latteDock.updateScale(appletId, zScale, zStep); + } + } + function calculateScales( currentMousePosition ){ if (root.editMode || root.zoomFactor===1 || root.durationTime===0) { return; @@ -495,32 +515,56 @@ MouseArea{ leftScale = bigNeighbourZoom; } + //! compute the neighbour separator scales + var bsNeighbourZoom = 1; + var ssNeighbourZoom = 1; + + if(root.internalSeparatorPos>=0) { + if((root.internalSeparatorPos === index+1) || (root.internalSeparatorPos === index-1) ){ + var sepZoomDifference = (root.maxSeparatorLength / (root.maxSeparatorLength+root.missingSeparatorLength)) * root.zoomFactor; + + bsNeighbourZoom = Math.max(1,bigNeighbourZoom - sepZoomDifference); + ssNeighbourZoom = Math.max(1,smallNeighbourZoom - sepZoomDifference); + } + } + // console.debug(leftScale + " " + rightScale + " " + index); - //activate messages to update the the neighbour scales - if(root.latteDock && index === root.tasksCount-1) - latteDock.updateScale(latteDock.latteAppletPos+1, rightScale, 0); - else - root.updateScale(index+1, rightScale, 0); + if(!root.hasInternalSeparator || Math.abs(index-root.internalSeparatorPos)>=2 + || mainItemContainer.isSeparator){ + //activate messages to update the the neighbour scales + updateIdSendScale(index+1, rightScale, 0); + updateIdSendScale(index-1, leftScale, 0); + + updateIdSendScale(index+2, 1, 0); + updateIdSendScale(index-2, 1, 0); + } else if(root.internalSeparatorPos>=0) { + if(root.internalSeparatorPos === index+1){ + if (!positiveDirection) { + updateIdSendScale(index+2, ssNeighbourZoom, 0); + } else { + updateIdSendScale(index+2, bsNeighbourZoom, 0); + } - if(root.latteDock && index === 0) - latteDock.updateScale(latteDock.latteAppletPos-1, leftScale, 0); - else - root.updateScale(index-1, leftScale, 0); + updateIdSendScale(index-1, leftScale, 0); + updateIdSendScale(index+1, rightScale, 0); - if(root.latteDock && index === root.tasksCount-1) - latteDock.updateScale(latteDock.latteAppletPos+2, 1, 0); - else if (root.latteDock && index === root.tasksCount-2) - latteDock.updateScale(latteDock.latteAppletPos+1, 1, 0); - else - root.updateScale(index+2, 1, 0); + updateIdSendScale(index+3, 1, 0); + updateIdSendScale(index-2, 1, 0); + } else if(root.internalSeparatorPos === index-1) { + if (!positiveDirection) { + updateIdSendScale(index-2, bsNeighbourZoom, 0); + } else { + updateIdSendScale(index-2, ssNeighbourZoom, 0); + } - if(root.latteDock && index === 0) - latteDock.updateScale(latteDock.latteAppletPos-2, 1, 0); - else if (root.latteDock && index === 1) - latteDock.updateScale(latteDock.latteAppletPos-1, 1, 0); - else - root.updateScale(index-2, 1, 0); + updateIdSendScale(index-1, leftScale, 0); + updateIdSendScale(index+1, rightScale, 0); + + updateIdSendScale(index+2, 1, 0); + updateIdSendScale(index-3, 1, 0); + } + } //Left hiddenSpacer if(((index === 0 )&&(icList.count > 1)) && !root.disableLeftSpacer){ @@ -539,7 +583,6 @@ MouseArea{ function signalUpdateScale(nIndex, nScale, step){ - //if ((index === nIndex)&&(!mainItemContainer.inAnimation)){ if ((index === nIndex)&&(mainItemContainer.hoverEnabled)&&(waitingLaunchers.length===0)){ if(nScale >= 0) { mScale = nScale + step; diff --git a/shell/contents/configuration/TweaksConfig.qml b/shell/contents/configuration/TweaksConfig.qml index 20ade4685..0e4ce0cec 100644 --- a/shell/contents/configuration/TweaksConfig.qml +++ b/shell/contents/configuration/TweaksConfig.qml @@ -221,7 +221,7 @@ PlasmaComponents.Page { //The Tasks separator adds a lot of complexity in the parabolic effect //signaling... For now I disable it and in the future if a better way //is found to support it with the parabolic effect we can enable it again - visible: false //dock.tasksPresent() + visible: dock.tasksPresent() // tooltip: i18n("Add a separator for tasks") onClicked: {