improve atScreenEdge code

pull/16/head
Michail Vourlakos 5 years ago
parent 9739c43674
commit 1cef4bb70f

@ -85,27 +85,52 @@ Item {
property bool isSystray: applet && (applet.pluginName === "org.kde.plasma.systemtray" || applet.pluginName === "org.nomad.systemtray" ) property bool isSystray: applet && (applet.pluginName === "org.kde.plasma.systemtray" || applet.pluginName === "org.nomad.systemtray" )
property bool firstChildOfStartLayout: index === layoutsContainer.startLayout.firstVisibleIndex property bool firstChildOfStartLayout: index === layoutsContainer.startLayout.firstVisibleIndex
property bool firstChildOfMainLayout: index === layoutsContainer.mainLayout.firstVisibleIndex
property bool lastChildOfMainLayout: index === layoutsContainer.mainLayout.lastVisibleIndex
property bool lastChildOfEndLayout: index === layoutsContainer.endLayout.lastVisibleIndex property bool lastChildOfEndLayout: index === layoutsContainer.endLayout.lastVisibleIndex
readonly property bool atScreenEdge: { readonly property bool atScreenEdge: {
if (plasmoid.configuration.maxLength!==100 || plasmoid.configuration.offset!==0) { if (root.panelAlignment !== Latte.Types.Justify || root.inConfigureAppletsMode || plasmoid.configuration.offset!==0) {
return false; return false;
} }
if (root.isHorizontal) { if (root.panelAlignment === Latte.Types.Justify) {
if (firstChildOfStartLayout) { //! Justify case
return latteView && latteView.x === latteView.screenGeometry.x; if (plasmoid.configuration.maxLength!==100) {
} else if (lastChildOfEndLayout) { return false;
return latteView && ((latteView.x + latteView.width) === (latteView.screenGeometry.x + latteView.screenGeometry.width));
} }
} else {
if (firstChildOfStartLayout) { if (root.isHorizontal) {
return latteView && latteView.y === latteView.screenGeometry.y; if (firstChildOfStartLayout) {
} else if (lastChildOfEndLayout) { return latteView && latteView.x === latteView.screenGeometry.x;
return latteView && ((latteView.y + latteView.height) === (latteView.screenGeometry.y + latteView.screenGeometry.height)); } else if (lastChildOfEndLayout) {
return latteView && ((latteView.x + latteView.width) === (latteView.screenGeometry.x + latteView.screenGeometry.width));
}
} else {
if (firstChildOfStartLayout) {
return latteView && latteView.y === latteView.screenGeometry.y;
} else if (lastChildOfEndLayout) {
return latteView && ((latteView.y + latteView.height) === (latteView.screenGeometry.y + latteView.screenGeometry.height));
}
} }
return false;
}
/*if (root.panelAlignment === Latte.Types.Left) {
//! Left case
return firstChildOfMainLayout;
} else if (root.panelAlignment === Latte.Types.Right) {
//! Right case
return lastChildOfMainLayout
} }
if (root.panelAlignment === Latte.Types.Top) {
return firstChildOfMainLayout && latteView && latteView.y === latteView.screenGeometry.y;
} else if (root.panelAlignment === Latte.Types.Bottom) {
return lastChildOfMainLayout && latteView && ((latteView.y + latteView.height) === (latteView.screenGeometry.y + latteView.screenGeometry.height));
}*/
return false; return false;
} }

Loading…
Cancel
Save