1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-25 19:21:41 +03:00

move fractions to MetricsPrivate

This commit is contained in:
Michail Vourlakos 2020-05-01 12:39:40 +03:00
parent ed3472b11f
commit e0d2991790
3 changed files with 19 additions and 20 deletions

View File

@ -28,6 +28,7 @@ ContainerAbility.Metrics {
id: mets
property Item animations: null
property Item autosize: null
property Item indicators: null
//! Private Properties
readonly property int portionIconSize: { //icon size based on screen height
@ -39,9 +40,18 @@ ContainerAbility.Metrics {
readonly property bool autosizeEnabled: autosize !== undefined && autosize.isActive
readonly property MetricsPrivateTypes.Fraction fraction: MetricsPrivateTypes.Fraction{}
readonly property MetricsPrivateTypes.Fraction fraction: MetricsPrivateTypes.Fraction{
thicknessMargin: root.shrinkThickMargins ? indicators.info.minThicknessPadding :
Math.max(indicators.info.minThicknessPadding, plasmoid.configuration.thickMargin / 100)
//! Behaviors
lengthMargin: plasmoid.configuration.lengthExtMargin / 100
lengthPadding: indicators.isEnabled ? indicators.padding : 0
lengthAppletPadding: indicators.infoLoaded ? indicators.info.appletLengthPadding : -1
}
//! BEHAVIORS
Behavior on iconSize {
enabled: !(root.editMode && root.behaveAsPlasmaPanel)
NumberAnimation {

View File

@ -168,8 +168,8 @@ Item {
//! local margins
readonly property bool parabolicEffectMarginsEnabled: root.zoomFactor>1 && !originalAppletBehavior
property int lengthAppletIntMargin: root.lengthAppletIntMarginFactor === -1 || parabolicEffectMarginsEnabled ?
root.lengthIntMargin : root.lengthAppletIntMarginFactor * metrics.iconSize
property int lengthAppletIntMargin: metrics.fraction.lengthAppletPadding === -1 || parabolicEffectMarginsEnabled ?
root.lengthIntMargin : metrics.fraction.lengthAppletPadding * metrics.iconSize
property int lengthAppletFullMargin: lengthAppletIntMargin + root.lengthExtMargin
property int lengthAppletFullMargins: 2 * lengthAppletFullMargin

View File

@ -386,22 +386,10 @@ Item {
return Math.max(panelBase, panelBase + percentage*maxPanelSize);
}
property int lengthIntMargin: lengthIntMarginFactor * metrics.iconSize
property int lengthExtMargin: lengthExtMarginFactor * metrics.iconSize
property real lengthIntMarginFactor: indicators.isEnabled ? indicators.padding : 0
property real lengthExtMarginFactor: plasmoid.configuration.lengthExtMargin / 100
property int lengthIntMargin: metrics.fraction.lengthPadding * metrics.iconSize
property int lengthExtMargin: metrics.fraction.lengthMargin * metrics.iconSize
property real lengthAppletIntMarginFactor: indicators.infoLoaded ? indicators.info.appletLengthPadding : -1
property real thickMarginFactor: {
if (shrinkThickMargins) {
return indicators.info.minThicknessPadding;
}
//0.075 old statesLineSize and 0.06 old default thickMargin
return Math.max(indicators.info.minThicknessPadding, plasmoid.configuration.thickMargin / 100)
}
property int thickMargin: thickMarginFactor * metrics.iconSize
property int thickMargin: metrics.fraction.thicknessMargin * metrics.iconSize
property bool screenEdgeMarginEnabled: plasmoid.configuration.screenEdgeMargin >= 0 && !plasmoid.configuration.shrinkThickMargins
property int screenEdgeMargin: {
@ -424,7 +412,7 @@ Item {
//it is used in order to not break the calculations for the thickness placement
//especially in automatic icon sizes calculations
property int maxThickMargin: thickMarginFactor * metrics.maxIconSize
property int maxThickMargin: metrics.fraction.thicknessMargin * metrics.maxIconSize
property int lengthMargin: lengthIntMargin + lengthExtMargin
property int lengthMargins: 2 * lengthMargin
@ -1755,6 +1743,7 @@ Item {
id: _metrics
animations: _animations
autosize: _autosize
indicators: indicatorsManager
}
///////////////END ABILITIES