1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-26 11:21:40 +03:00

Unity:fix windows indicators for vertical views

This commit is contained in:
Michail Vourlakos 2019-03-14 18:42:36 +02:00
parent a919dc3fca
commit bc0ad9d19f

View File

@ -124,18 +124,7 @@ Item{
id: upperIndicators id: upperIndicators
spacing: 2 spacing: 2
readonly property bool alwaysActive: true readonly property bool alwaysActive: true
readonly property bool reversed: true
rotation: {
if (plasmoid.location === PlasmaCore.Types.RightEdge) {
return 90;
} else if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
return 180;
} else if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
return 270;
}
return 0;
}
Repeater { Repeater {
model: rootItem.isActive || rootItem.hasActive ? 1 : 0 model: rootItem.isActive || rootItem.hasActive ? 1 : 0
@ -143,23 +132,15 @@ Item{
} }
} }
Row { Grid {
id: lowerIndicators id: lowerIndicators
spacing: 2 rows: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? 1 : Math.min(3, rootItem.windowsCount)
columns: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? Math.min(3, rootItem.windowsCount) : 1
rowSpacing: 2
columnSpacing: 2
readonly property bool alwaysActive: false readonly property bool alwaysActive: false
readonly property bool reversed: false
rotation: {
if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
return 90;
} else if (plasmoid.location === PlasmaCore.Types.TopEdge) {
return 180;
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
return 270;
}
return 0;
}
Repeater { Repeater {
model: Math.min(3, rootItem.windowsCount) model: Math.min(3, rootItem.windowsCount)
@ -176,6 +157,32 @@ Item{
width: rootItem.currentIconSize / 7 width: rootItem.currentIconSize / 7
height: width height: width
rotation: {
if (!parent.reversed) {
if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
return 0;
} else if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
return 90;
} else if (plasmoid.location === PlasmaCore.Types.TopEdge) {
return 180;
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
return 270;
}
} else {
if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
return 180;
} else if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
return 270;
} else if (plasmoid.location === PlasmaCore.Types.TopEdge) {
return 0;
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
return 90;
}
}
return 0;
}
property color drawColor: theme.buttonFocusColor; property color drawColor: theme.buttonFocusColor;
property bool fillTriangle: { property bool fillTriangle: {
if (!parent.alwaysActive && rootItem.windowsMinimizedCount!==0 if (!parent.alwaysActive && rootItem.windowsMinimizedCount!==0
@ -193,7 +200,7 @@ Item{
onPaint: { onPaint: {
var ctx = getContext('2d'); var ctx = getContext('2d');
ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = drawColor; ctx.fillStyle = fillTriangle ? drawColor : theme.backgroundColor;
ctx.strokeStyle = drawColor; ctx.strokeStyle = drawColor;
ctx.lineWidth = 2; ctx.lineWidth = 2;
@ -204,14 +211,11 @@ Item{
ctx.lineTo(0, canvas.height); ctx.lineTo(0, canvas.height);
ctx.closePath(); ctx.closePath();
if (fillTriangle) {
ctx.fill(); ctx.fill();
} else {
ctx.stroke(); ctx.stroke();
} }
} }
} }
}
//! States //! States
states: [ states: [