Update
This commit is contained in:
parent
395fc82614
commit
2e9044e282
|
@ -143,55 +143,56 @@ Item{
|
|||
|
||||
function popupPosition(width, height) {
|
||||
var screenAvail = kicker.availableScreenRect;
|
||||
var screenGeom = kicker.screenGeometry;
|
||||
var screen = Qt.rect(screenAvail.x + screenGeom.x,
|
||||
screenAvail.y + screenGeom.y,
|
||||
screenAvail.width,
|
||||
screenAvail.height);
|
||||
|
||||
|
||||
var offset = Kirigami.Units.smallSpacing;
|
||||
|
||||
// Fall back to bottom-left of screen area when the applet is on the desktop or floating.
|
||||
var x = offset;
|
||||
var y = screen.height - height - offset;
|
||||
var appletTopLeft;
|
||||
var horizMidPoint;
|
||||
var vertMidPoint;
|
||||
var screen = kicker.screenGeometry;
|
||||
var panelH = kicker.height
|
||||
var panelW = kicker.width
|
||||
var horizMidPoint = screen.x + (screen.width / 2);
|
||||
var vertMidPoint = screen.y + (screen.height / 2);
|
||||
var appletTopLeft = parent.mapToGlobal(0, 0);
|
||||
|
||||
var offset = Kirigami.Units.smallSpacing * 2;
|
||||
|
||||
if (Plasmoid.configuration.displayPosition === 1) {
|
||||
horizMidPoint = screen.x + (screen.width / 2);
|
||||
vertMidPoint = screen.y + (screen.height / 2);
|
||||
x = horizMidPoint - width / 2;
|
||||
y = vertMidPoint - height / 2;
|
||||
} else if (Plasmoid.configuration.displayPosition === 2) {
|
||||
}
|
||||
|
||||
else if (Plasmoid.configuration.displayPosition === 2) {
|
||||
horizMidPoint = screen.x + (screen.width / 2);
|
||||
vertMidPoint = screen.y + (screen.height / 2);
|
||||
x = horizMidPoint - width / 2;
|
||||
y = screen.y + screen.height - height - offset - panelSvg.margins.top;
|
||||
} else if (Plasmoid.location === PlasmaCore.Types.BottomEdge) {
|
||||
horizMidPoint = screen.x + (screen.width / 2);
|
||||
appletTopLeft = parent.mapToGlobal(0, 0);
|
||||
x = (appletTopLeft.x < horizMidPoint) ? screen.x + offset : (screen.x + screen.width) - width - offset;
|
||||
y = screen.y + screen.height - height - offset - panelSvg.margins.top;
|
||||
} else if (Plasmoid.location === PlasmaCore.Types.TopEdge) {
|
||||
horizMidPoint = screen.x + (screen.width / 2);
|
||||
var appletBottomLeft = parent.mapToGlobal(0, parent.height);
|
||||
x = (appletBottomLeft.x < horizMidPoint) ? screen.x + offset : (screen.x + screen.width) - width - offset;
|
||||
//y = screen.y + parent.height + panelSvg.margins.bottom + offset;
|
||||
y = screen.y + panelSvg.margins.bottom + offset;
|
||||
} else if (Plasmoid.location === PlasmaCore.Types.LeftEdge) {
|
||||
vertMidPoint = screen.y + (screen.height / 2);
|
||||
appletTopLeft = parent.mapToGlobal(0, 0);
|
||||
x = appletTopLeft.x*2 + parent.width + panelSvg.margins.right + offset;
|
||||
y = screen.y + (appletTopLeft.y < vertMidPoint) ? screen.y + offset : (screen.y + screen.height) - height - offset;
|
||||
} else if (Plasmoid.location === PlasmaCore.Types.RightEdge) {
|
||||
vertMidPoint = screen.y + (screen.height / 2);
|
||||
appletTopLeft = parent.mapToGlobal(0, 0);
|
||||
x = appletTopLeft.x - panelSvg.margins.left - offset - width;
|
||||
y = screen.y + (appletTopLeft.y < vertMidPoint) ? screen.y + offset : (screen.y + screen.height) - height - offset;
|
||||
y = screen.y + screen.height - height - offset - panelH - Kirigami.Units.gridUnit;
|
||||
}
|
||||
|
||||
else {
|
||||
switch (plasmoid.location) {
|
||||
case PlasmaCore.Types.BottomEdge:
|
||||
var y = appletTopLeft.y - height - offset
|
||||
var x = appletTopLeft.x
|
||||
break;
|
||||
|
||||
case PlasmaCore.Types.TopEdge:
|
||||
x = appletTopLeft.x < screen.width - width ? appletTopLeft.x + panelW - Kirigami.Units.gridUnit / 3 : screen.width - width;
|
||||
y = appletTopLeft.y + kicker.height + Kirigami.Units.gridUnit
|
||||
break;
|
||||
|
||||
case PlasmaCore.Types.LeftEdge:
|
||||
x = appletTopLeft.x + panelW + Kirigami.Units.gridUnit / 2;
|
||||
y = appletTopLeft.y < screen.height - height ? appletTopLeft.y : appletTopLeft.y - height + iconUser.height / 2;
|
||||
break;
|
||||
|
||||
case PlasmaCore.Types.RightEdge:
|
||||
x = appletTopLeft.x - width - Kirigami.Units.gridUnit / 2;
|
||||
y = appletTopLeft.y < screen.height - height ? appletTopLeft.y : screen.height - height - Kirigami.Units.gridUnit / 5;
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return Qt.point(x, y);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue