1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-27 02:50:22 +03:00

provide proper Metrics values for MarginsArea

This commit is contained in:
Michail Vourlakos 2021-02-27 09:57:05 +02:00
parent 1fa48b00eb
commit a5ceb16e39
7 changed files with 30 additions and 28 deletions

View File

@ -27,6 +27,7 @@ import org.kde.latte.core 0.2 as LatteCore
import "./privates" as Ability
Ability.MetricsPrivate {
id: metrics
//! Signals
signal iconSizeAnimationEnded();
@ -46,9 +47,26 @@ Ability.MetricsPrivate {
|| root.hideThickScreenGap ?
0 : plasmoid.configuration.screenEdgeMargin
//! MarginsAra
marginsArea.marginThickness: {
if (!themeExtended) {
return metrics.margin.thickness;
}
if (plasmoid.location === PlasmaCore.Types.TopEdge) {
return themeExtended.marginsAreaBottom + metrics.margin.thickness;
} else if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
return themeExtended.marginsAreaRight + metrics.margin.thickness;
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
return themeExtended.marginsAreaLeft + metrics.margin.thickness;
}
return themeExtended.marginsAreaTop + metrics.margin.thickness;
}
//! Mask
mask.maxScreenEdge : root.behaveAsDockWithMask ? Math.max(0, plasmoid.configuration.screenEdgeMargin) : 0
//! window geometry is updated after the local screen margin animation was zeroed*/
// window geometry is updated after the local screen margin animation was zeroed*/
mask.screenEdge: (!root.screenEdgeMarginEnabled || root.hideThickScreenGap) ? 0 : plasmoid.configuration.screenEdgeMargin
mask.thickness.hidden: LatteCore.WindowSystem.compositingActive ? 2 : 1
@ -72,22 +90,4 @@ Ability.MetricsPrivate {
//! Padding
padding.length: fraction.lengthPadding * iconSize
padding.lengthApplet: fraction.lengthAppletPadding * iconSize
//! Margins Area
readonly property int marginsAreaThickness: {
if (!themeExtended) {
return 0;
}
if (plasmoid.location === PlasmaCore.Types.TopEdge) {
return themeExtended.marginsAreaBottom;
} else if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
return themeExtended.marginsAreaRight;
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
return themeExtended.marginsAreaLeft;
}
return themeExtended.marginsAreaTop;
}
}

View File

@ -93,7 +93,7 @@ Item{
property real appletMaximumHeight: applet && applet.Layout ? applet.Layout.maximumHeight : -1
readonly property int proposedItemSize: appletItem.inMarginsArea && !appletItem.canFillThickness ?
Math.max(16,appletItem.metrics.iconSize - 2*appletItem.metrics.marginsAreaThickness) :
Math.max(16,appletItem.metrics.marginsArea.iconSize) :
appletItem.metrics.iconSize
readonly property real appletLength: root.isHorizontal ? appletWidth : appletHeight
@ -132,7 +132,7 @@ Item{
if (appletItem.canFillThickness) {
return 0;
} else if (appletItem.inMarginsArea) {
return appletItem.metrics.totals.thicknessEdges + (appletItem.metrics.marginsAreaThickness * 2);
return appletItem.metrics.marginsArea.thicknessEdges;
}
return appletItem.metrics.totals.thicknessEdges;
@ -464,7 +464,7 @@ Item{
if (appletItem.screenEdgeMarginSupported) {
return 0;
} else if (appletItem.inMarginsArea) {
return appliedEdgeMargin + (wrapper.zoomScaleThickness * (appletItem.metrics.margin.thickness + appletItem.metrics.marginsAreaThickness));
return appliedEdgeMargin + (wrapper.zoomScaleThickness * appletItem.metrics.marginsArea.marginThickness);
}
return appliedEdgeMargin + (wrapper.zoomScaleThickness * appletItem.metrics.margin.thickness);
@ -474,7 +474,7 @@ Item{
if (appletItem.canFillThickness || appletItem.screenEdgeMarginSupported) {
return 0;
} else if (appletItem.inMarginsArea) {
return appletItem.metrics.margin.thickness + appletItem.metrics.marginsAreaThickness;
return appletItem.metrics.marginsArea.marginThickness;
}
return appletItem.metrics.margin.thickness

View File

@ -26,7 +26,7 @@ Item {
if (appletItem.canFillThickness || appletItem.screenEdgeMarginSupported) {
return 1;
} else if (appletItem.inMarginsArea) {
return appletItem.metrics.margin.thickness + appletItem.metrics.marginsAreaThickness;
return appletItem.metrics.marginsArea.marginThickness;
}
return appletItem.metrics.margin.thickness;

View File

@ -30,6 +30,7 @@ AbilityDefinition.Metrics {
backgroundThickness: ref.metrics.backgroundThickness
margin: ref.metrics.margin
marginsArea: ref.metrics.marginsArea
mask: ref.metrics.mask
padding: ref.metrics.padding
totals: ref.metrics.totals

View File

@ -35,8 +35,8 @@ Item {
}
property MetricsTypes.MarginsArea marginsArea: MetricsTypes.MarginsArea{
property int marginThickness: 4
//readonly property int iconSize: _metrics.iconSize - thicknessEdges
marginThickness: 8 //margin.thickness + 4
//readonly property int iconSize: _metrics.totals.thickness - thicknessEdges
//readonly property int thicknessEdges: 2*marginThickness
}

View File

@ -20,7 +20,7 @@
import QtQuick 2.0
Item {
property int marginThickness: 4
readonly property int iconSize: _metrics.iconSize - thicknessEdges
property int marginThickness: 8
readonly property int iconSize: _metrics.totals.thickness - thicknessEdges
readonly property int thicknessEdges: 2*marginThickness
}

View File

@ -30,6 +30,7 @@ AbilityDefinition.Metrics {
readonly property alias backgroundThickness: apis.backgroundThickness
readonly property alias margin: apis.margin
readonly property alias marginsArea: apis.marginsArea
readonly property alias mask: apis.mask
readonly property alias padding: apis.padding
readonly property alias totals: apis.totals