mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-21 10:50:30 +03:00
fix #431,support again the internal separator
--support again the internal separator based on the new signaling for the parabolic effect
This commit is contained in:
parent
6fac93171f
commit
6fb56f90b1
@ -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 && indx>=root.latteAppletPos)
|
||||
|| (index>root.latteAppletPos && indx<=root.latteAppletPos)) ){
|
||||
var appStep = Math.abs(root.latteAppletPos-index);
|
||||
var signalStep = Math.abs(indx - index);
|
||||
|
||||
if(index<root.latteAppletPos){
|
||||
root.latteApplet.updateScale(signalStep-appStep, zScale,zStep);
|
||||
} else if (index>root.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);
|
||||
//! compute the neighbour separator scales
|
||||
var bsNeighbourZoom = 1;
|
||||
var ssNeighbourZoom = 1;
|
||||
|
||||
if(root.latteApplet && index===root.latteAppletPos-1)
|
||||
root.latteApplet.updateScale(0, rightScale, 0);
|
||||
else
|
||||
root.updateScale(index+1, rightScale, 0);
|
||||
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;
|
||||
|
||||
bsNeighbourZoom = Math.max(1,bigNeighbourZoom - sepZoomDifference);
|
||||
ssNeighbourZoom = Math.max(1,smallNeighbourZoom - sepZoomDifference);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
if(!root.latteApplet || Math.abs(root.latteAppletPos-index)>1
|
||||
|| (root.hasInternalSeparator
|
||||
&& ((root.latteApplet.internalSeparatorPos>0 && root.latteApplet.internalSeparatorPos<root.tasksCount-1)
|
||||
|| (root.latteApplet.internalSeparatorPos===0 && index>root.latteAppletPos)
|
||||
|| (root.latteApplet.internalSeparatorPos===root.tasksCount-1 && index<root.latteAppletPos)))
|
||||
){
|
||||
updateIdSendScale(index-1, leftScale, 0);
|
||||
updateIdSendScale(index+1, rightScale, 0);
|
||||
|
||||
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);
|
||||
updateIdSendScale(index-2, 1, 0);
|
||||
updateIdSendScale(index+2, 1 ,0);
|
||||
} else{
|
||||
if(latApp.internalSeparatorPos === 0){
|
||||
if (!positiveDirection) {
|
||||
updateIdSendScale(index+2, ssNeighbourZoom, 0);
|
||||
} else {
|
||||
updateIdSendScale(index+2, bsNeighbourZoom, 0);
|
||||
}
|
||||
|
||||
updateIdSendScale(index-1, leftScale, 0);
|
||||
updateIdSendScale(index+1, rightScale, 0);
|
||||
|
||||
updateIdSendScale(index+3, 1, 0);
|
||||
updateIdSendScale(index-2, 1, 0);
|
||||
} else if(root.hasInternalSeparator && latApp.internalSeparatorPos === root.tasksCount-1) {
|
||||
if (!positiveDirection) {
|
||||
updateIdSendScale(index-2, bsNeighbourZoom, 0);
|
||||
} else {
|
||||
updateIdSendScale(index-2, ssNeighbourZoom, 0);
|
||||
}
|
||||
|
||||
updateIdSendScale(index-1, leftScale, 0);
|
||||
updateIdSendScale(index+1, rightScale, 0);
|
||||
|
||||
updateIdSendScale(index+2, 1, 0);
|
||||
updateIdSendScale(index-3, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (root.latteApplet && Math.abs(index - root.latteAppletPos) > 2){
|
||||
root.latteApplet.clearZoom();
|
||||
|
@ -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);
|
||||
|
||||
if(root.latteDock && index === 0)
|
||||
latteDock.updateScale(latteDock.latteAppletPos-1, leftScale, 0);
|
||||
else
|
||||
root.updateScale(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 === 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-1, leftScale, 0);
|
||||
updateIdSendScale(index+1, rightScale, 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+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);
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -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: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user