mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-24 17:33:50 +03:00
fixes for spacers and positioning of behaveAsPanel
--fix positioning for Right/Bottom alignments when View behavesAsPlasmaPanel
This commit is contained in:
parent
efe3defad6
commit
edb943db6b
@ -601,7 +601,7 @@ void Positioner::updatePosition(QRect availableScreenRect)
|
||||
if (m_view->alignment() == Latte::Types::Left) {
|
||||
position = {screenGeometry.x() + gap(screenGeometry.width()), y};
|
||||
} else if (m_view->alignment() == Latte::Types::Right) {
|
||||
position = {screenGeometry.x() + gapReversed(screenGeometry.width()), y};
|
||||
position = {screenGeometry.x() + gapReversed(screenGeometry.width()) + 1, y};
|
||||
} else {
|
||||
position = {screenGeometry.x() + gapCentered(screenGeometry.width()), y};
|
||||
}
|
||||
@ -618,7 +618,7 @@ void Positioner::updatePosition(QRect availableScreenRect)
|
||||
if (m_view->alignment() == Latte::Types::Left) {
|
||||
position = {screenGeometry.x() + gap(screenGeometry.width()), y};
|
||||
} else if (m_view->alignment() == Latte::Types::Right) {
|
||||
position = {screenGeometry.x() + gapReversed(screenGeometry.width()), y};
|
||||
position = {screenGeometry.x() + gapReversed(screenGeometry.width()) + 1, y};
|
||||
} else {
|
||||
position = {screenGeometry.x() + gapCentered(screenGeometry.width()), y};
|
||||
}
|
||||
@ -635,7 +635,7 @@ void Positioner::updatePosition(QRect availableScreenRect)
|
||||
if (m_view->alignment() == Latte::Types::Top) {
|
||||
position = {x, availableScreenRect.y() + gap(availableScreenRect.height())};
|
||||
} else if (m_view->alignment() == Latte::Types::Bottom) {
|
||||
position = {x, availableScreenRect.y() + gapReversed(availableScreenRect.height())};
|
||||
position = {x, availableScreenRect.y() + gapReversed(availableScreenRect.height()) + 1};
|
||||
} else {
|
||||
position = {x, availableScreenRect.y() + gapCentered(availableScreenRect.height())};
|
||||
}
|
||||
@ -652,7 +652,7 @@ void Positioner::updatePosition(QRect availableScreenRect)
|
||||
if (m_view->alignment() == Latte::Types::Top) {
|
||||
position = {x, availableScreenRect.y() + gap(availableScreenRect.height())};
|
||||
} else if (m_view->alignment() == Latte::Types::Bottom) {
|
||||
position = {x, availableScreenRect.y() + gapReversed(availableScreenRect.height())};
|
||||
position = {x, availableScreenRect.y() + gapReversed(availableScreenRect.height()) + 1};
|
||||
} else {
|
||||
position = {x, availableScreenRect.y() + gapCentered(availableScreenRect.height())};
|
||||
}
|
||||
|
@ -97,13 +97,13 @@ Item {
|
||||
property bool lastChildOfEndLayout: index === appletItem.layouter.endLayout.lastVisibleIndex
|
||||
|
||||
readonly property bool atScreenEdge: {
|
||||
if (root.panelAlignment !== LatteCore.Types.Justify || root.inConfigureAppletsMode || plasmoid.configuration.offset!==0) {
|
||||
if (root.panelAlignment === LatteCore.Types.Center) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (root.panelAlignment === LatteCore.Types.Justify) {
|
||||
//! Justify case
|
||||
if (root.maxLengthPerCentage!==100) {
|
||||
if (root.maxLengthPerCentage!==100 || plasmoid.configuration.offset!==0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -124,21 +124,19 @@ Item {
|
||||
return false;
|
||||
}
|
||||
|
||||
//! [disabled] because it is probably not needed at all. If in the future there is a report
|
||||
//! describing a case that this would be useful this disablement choice can be rethought
|
||||
/*if (root.panelAlignment === LatteCore.Types.Left) {
|
||||
if (root.panelAlignment === LatteCore.Types.Left && plasmoid.configuration.offset===0) {
|
||||
//! Left case
|
||||
return firstChildOfMainLayout;
|
||||
} else if (root.panelAlignment === LatteCore.Types.Right) {
|
||||
} else if (root.panelAlignment === LatteCore.Types.Right && plasmoid.configuration.offset===0) {
|
||||
//! Right case
|
||||
return lastChildOfMainLayout
|
||||
return lastChildOfMainLayout;
|
||||
}
|
||||
|
||||
if (root.panelAlignment === LatteCore.Types.Top) {
|
||||
if (root.panelAlignment === LatteCore.Types.Top && plasmoid.configuration.offset===0) {
|
||||
return firstChildOfMainLayout && latteView && latteView.y === latteView.screenGeometry.y;
|
||||
} else if (root.panelAlignment === LatteCore.Types.Bottom) {
|
||||
} else if (root.panelAlignment === LatteCore.Types.Bottom && plasmoid.configuration.offset===0) {
|
||||
return lastChildOfMainLayout && latteView && ((latteView.y + latteView.height) === (latteView.screenGeometry.y + latteView.screenGeometry.height));
|
||||
}*/
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -49,8 +49,17 @@ Item{
|
||||
|
||||
readonly property bool atEdgeForcingFittsLaw: !isSeparator && !parabolicEffectMarginsEnabled && atScreenEdge
|
||||
readonly property int subtrackedMargins: {
|
||||
if (atEdgeForcingFittsLaw && !appletItem.isAutoFillApplet && ((firstChildOfStartLayout && rightSpacer) || (lastChildOfEndLayout && !rightSpacer ))) {
|
||||
return (wrapper.edgeLengthMarginsDisabled ? appletItem.metrics.margin.length + appletItem.lengthAppletPadding : appletItem.metrics.margin.length);
|
||||
if (atEdgeForcingFittsLaw && !appletItem.isAutoFillApplet) {
|
||||
var inJustifyStart = (root.inFullJustify && firstChildOfStartLayout && rightSpacer);
|
||||
var inJustifyEnd = (root.inFullJustify && lastChildOfEndLayout && !rightSpacer);
|
||||
|
||||
var singleApplet = firstChildOfMainLayout && lastChildOfMainLayout;
|
||||
var inSideStart = ((root.panelAlignment === LatteCore.Types.Left || root.panelAlignment === LatteCore.Types.Top) && firstChildOfMainLayout && rightSpacer);
|
||||
var inSideEnd = ((root.panelAlignment === LatteCore.Types.Right || root.panelAlignment === LatteCore.Types.Bottom) && lastChildOfMainLayout && !rightSpacer);
|
||||
|
||||
if (inJustifyStart || inJustifyEnd || inSideStart || inSideEnd) {
|
||||
return (wrapper.edgeLengthMarginsDisabled ? appletItem.metrics.margin.length + appletItem.lengthAppletPadding : appletItem.metrics.margin.length);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -301,7 +301,7 @@ Item{
|
||||
target: wrapper
|
||||
property: "marginsLength"
|
||||
when: latteView && (!root.inStartup || visibilityManager.inTempHiding)
|
||||
value: root.inFullJustify && atScreenEdge && !parabolicEffectMarginsEnabled ? edgeLengthMargins : localLengthMargins
|
||||
value: atScreenEdge && !parabolicEffectMarginsEnabled ? edgeLengthMargins : localLengthMargins
|
||||
}
|
||||
|
||||
function updateAutoFillLength() {
|
||||
|
Loading…
Reference in New Issue
Block a user