mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-21 10:50:30 +03:00
simplify parabolic signalling
--this finally creates a very concrete parabolic animation experience
This commit is contained in:
parent
fd4af3f0f1
commit
adba5b6f2a
@ -162,18 +162,6 @@ Item {
|
||||
//this functions gets the signal from the plasmoid, it can be used for signal items
|
||||
//outside the LatteApplet Plasmoid
|
||||
//property int debCounter: 0;
|
||||
function interceptLatteAppletUpdateScale(dIndex, newScale, step){
|
||||
if(!root.editMode){
|
||||
if(dIndex <= -1){
|
||||
layoutsContainer.updateScale(index+dIndex,newScale, step);
|
||||
}
|
||||
else if(dIndex >= root.tasksCount){
|
||||
var dif = dIndex - root.tasksCount + 1;
|
||||
layoutsContainer.updateScale(index+dif,newScale, step);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function clearZoom(){
|
||||
if (root.globalDirectRender){
|
||||
wrapper.zoomScale = 1;
|
||||
@ -265,7 +253,6 @@ Item {
|
||||
root.latteAppletPos = index;
|
||||
latteApplet.latteDock = root;
|
||||
latteApplet.forceHidePanel = true;
|
||||
latteApplet.updateScale.connect(interceptLatteAppletUpdateScale);
|
||||
}
|
||||
}
|
||||
|
||||
@ -905,57 +892,34 @@ Item {
|
||||
leftScale = bigNeighbourZoom;
|
||||
}
|
||||
|
||||
//! compute the neighbour separator scales for latteApplet
|
||||
var bsNeighbourZoom = 1;
|
||||
var ssNeighbourZoom = 1;
|
||||
|
||||
if(root.latteApplet && root.latteApplet.internalSeparatorPos>=0) {
|
||||
var latApp = root.latteApplet;
|
||||
|
||||
if((latApp.internalSeparatorPos === latApp.tasksCount - 1) || (latApp.internalSeparatorPos === 0) &&
|
||||
(index === root.latteAppletPos-1 || index === root.latteAppletPos+1 )){
|
||||
var maxTaskLength = latApp.maxSeparatorLength+latApp.missingSeparatorLength;
|
||||
var sepZoomDifference = (latApp.maxSeparatorLength / maxTaskLength) * root.zoomFactor;
|
||||
|
||||
bsNeighbourZoom = Math.max(1,bigNeighbourZoom - sepZoomDifference);
|
||||
ssNeighbourZoom = Math.max(1,smallNeighbourZoom - sepZoomDifference);
|
||||
|
||||
if(latApp.internalSeparatorPos === 0 && (index === root.latteAppletPos-1) ){
|
||||
if (!positiveDirection) {
|
||||
latApp.updateScale(1, ssNeighbourZoom, 0);
|
||||
} else {
|
||||
latApp.updateScale(1, bsNeighbourZoom, 0);
|
||||
}
|
||||
} else if((latApp.internalSeparatorPos === latApp.tasksCount - 1) &&(index === root.latteAppletPos+1)) {
|
||||
if (!positiveDirection) {
|
||||
latApp.updateScale(latApp.tasksCount-2, bsNeighbourZoom, 0);
|
||||
} else {
|
||||
latApp.updateScale(latApp.tasksCount-2, ssNeighbourZoom, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// console.log("--------------")
|
||||
// console.debug(leftScale + " " + rightScale + " " + index);
|
||||
//activate messages to update the the neighbour scales
|
||||
layoutsContainer.updateScale(index-1, leftScale, 0);
|
||||
layoutsContainer.updateScale(index+1, rightScale, 0);
|
||||
//these messages interfere when an applet is hidden, that is why I disabled them
|
||||
// currentLayout.updateScale(index-2, 1, 0);
|
||||
// currentLayout.updateScale(index+2, 1, 0);
|
||||
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) {
|
||||
if ((index-1) > root.latteAppletPos ){
|
||||
root.latteApplet.updateScale(root.tasksCount-1, 1 ,0);
|
||||
} else if((index+1)<root.latteAppletPos) {
|
||||
root.latteApplet.updateScale(0, 1, 0);
|
||||
}
|
||||
if(root.latteApplet && index===root.latteAppletPos-1)
|
||||
root.latteApplet.updateScale(0, rightScale, 0);
|
||||
else
|
||||
root.updateScale(index+1, rightScale, 0);
|
||||
|
||||
|
||||
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 && 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 (Math.abs(index - root.latteAppletPos) > 2){
|
||||
root.latteApplet.clearZoom();
|
||||
}
|
||||
}
|
||||
|
||||
//Left hiddenSpacer
|
||||
if(container.startEdge){
|
||||
@ -985,34 +949,19 @@ Item {
|
||||
else
|
||||
zoomScale = zoomScale + step;
|
||||
}
|
||||
else{
|
||||
if(layoutsContainer.hoveredIndex<container.index){
|
||||
latteApplet.updateScale(0, nScale, step);
|
||||
if (root.latteInternalSeparatorPos!==0)
|
||||
latteApplet.updateScale(1, 1, 0);
|
||||
else
|
||||
latteApplet.updateScale(2, 1, 0);
|
||||
} else if(layoutsContainer.hoveredIndex>container.index) {
|
||||
latteApplet.updateScale(root.tasksCount-1, nScale, step);
|
||||
if (root.latteInternalSeparatorPos!==root.tasksCount-1)
|
||||
latteApplet.updateScale(root.tasksCount-2, 1, 0);
|
||||
else
|
||||
latteApplet.updateScale(root.tasksCount-3, 1, 0);
|
||||
}
|
||||
}
|
||||
} ///if the applet is hidden must forward its scale events to its neighbours
|
||||
else if ((applet && (applet.status === PlasmaCore.Types.HiddenStatus))
|
||||
|| container.isInternalViewSplitter){
|
||||
if(layoutsContainer.hoveredIndex>index)
|
||||
layoutsContainer.updateScale(index-1, nScale, step);
|
||||
root.updateScale(index-1, nScale, step);
|
||||
else if((layoutsContainer.hoveredIndex<index))
|
||||
layoutsContainer.updateScale(index+1, nScale, step);
|
||||
root.updateScale(index+1, nScale, step);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
layoutsContainer.updateScale.connect(signalUpdateScale);
|
||||
root.updateScale.connect(signalUpdateScale);
|
||||
}
|
||||
}// Main task area // id:wrapper
|
||||
|
||||
|
@ -41,6 +41,7 @@ DragDrop.DropArea {
|
||||
signal clearZoomSignal();
|
||||
signal updateEffectsArea();
|
||||
signal updateIndexes();
|
||||
signal updateScale(int delegateIndex, real newScale, real step);
|
||||
//// END SIGNALS
|
||||
|
||||
////BEGIN properties
|
||||
@ -1326,8 +1327,6 @@ DragDrop.DropArea {
|
||||
Item{
|
||||
id: layoutsContainer
|
||||
|
||||
signal updateScale(int delegateIndex, real newScale, real step)
|
||||
|
||||
property int allCount: root.latteApplet ? mainLayout.count-1+latteApplet.tasksCount : mainLayout.count
|
||||
property int currentSpot: -1000
|
||||
property int hoveredIndex: -1
|
||||
|
@ -495,85 +495,32 @@ 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
|
||||
root.updateScale(index+1, rightScale, 0);
|
||||
root.updateScale(index-1, leftScale, 0);
|
||||
if(root.latteDock && index === root.tasksCount-1)
|
||||
latteDock.updateScale(latteDock.latteAppletPos+1, rightScale, 0);
|
||||
else
|
||||
root.updateScale(index+1, rightScale, 0);
|
||||
|
||||
if(!root.hasInternalSeparator) {
|
||||
//restore neighbour tasks
|
||||
/* var hIndex = index + 2;
|
||||
var lIndex = index - 2;
|
||||
if(root.latteDock && index === 0)
|
||||
latteDock.updateScale(latteDock.latteAppletPos-1, leftScale, 0);
|
||||
else
|
||||
root.updateScale(index-1, leftScale, 0);
|
||||
|
||||
if (hIndex<=icList.tasksCount)
|
||||
root.updateScale(hIndex, 1, 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);
|
||||
|
||||
if (lIndex>=-1)
|
||||
root.updateScale(lIndex, 1, 0);*/
|
||||
|
||||
} else if(root.internalSeparatorPos>=0) {
|
||||
if(root.internalSeparatorPos === index+1){
|
||||
if (!positiveDirection) {
|
||||
root.updateScale(index+2, ssNeighbourZoom, 0);
|
||||
} else {
|
||||
root.updateScale(index+2, bsNeighbourZoom, 0);
|
||||
}
|
||||
|
||||
//restore neighbour tasks
|
||||
/* var hIndex = index + 3;
|
||||
var lIndex = index - 2;
|
||||
|
||||
if (hIndex<=icList.tasksCount)
|
||||
root.updateScale(hIndex, 1, 0);
|
||||
|
||||
if (lIndex>=-1)
|
||||
root.updateScale(lIndex, 1, 0);*/
|
||||
|
||||
} else if(root.internalSeparatorPos === index-1) {
|
||||
if (!positiveDirection) {
|
||||
root.updateScale(index-2, bsNeighbourZoom, 0);
|
||||
} else {
|
||||
root.updateScale(index-2, ssNeighbourZoom, 0);
|
||||
}
|
||||
|
||||
//restore neighbour tasks
|
||||
/* var hIndex = index + 2;
|
||||
var lIndex = index - 3;
|
||||
|
||||
if (hIndex<=icList.tasksCount)
|
||||
root.updateScale(hIndex, 1, 0);
|
||||
|
||||
if (lIndex>=-1)
|
||||
root.updateScale(lIndex, 1, 0);*/
|
||||
}
|
||||
}
|
||||
|
||||
//extra restoring signals for applets around the plasmoid
|
||||
//at the low end
|
||||
if (index>=2 || ((index>=1) && (!root.hasInternalSeparator || root.internalSeparatorPos>1)) ) {
|
||||
root.updateScale(-1, 1, 0);
|
||||
}
|
||||
//at the high end
|
||||
if (index<=root.tasksCount-3
|
||||
|| ((index<=root.tasksCount-2)
|
||||
&& (!root.hasInternalSeparator
|
||||
|| (root.hasInternalSeparator && root.internalSeparatorPos<root.tasksCount-2)) )) {
|
||||
root.updateScale(root.tasksCount, 1, 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);
|
||||
|
||||
//Left hiddenSpacer
|
||||
if(((index === 0 )&&(icList.count > 1)) && !root.disableLeftSpacer){
|
||||
|
Loading…
x
Reference in New Issue
Block a user