upgrade extras thicknessed to abilities

pull/21/head
Michail Vourlakos 4 years ago
parent 60f8e3017f
commit cec7cc5950

@ -73,27 +73,21 @@ Item{
}
property int thicknessAutoHidden: LatteCore.WindowSystem.compositingActive ? 2 : 1
property int thicknessMid: metrics.mask.screenEdge + (1 + (0.65 * (parabolic.factor.maxZoom-1)))*(metrics.totals.thickness+extraZoomThickMask) //needed in some animations
property int thicknessNormal: metrics.mask.screenEdge + Math.max(metrics.totals.thickness + extraNormalThickMask, background.thickness + background.shadows.headThickness)
property int thicknessMid: metrics.mask.screenEdge + (1 + (0.65 * (parabolic.factor.maxZoom-1)))*(metrics.totals.thickness+metrics.extraThicknessForZoomed) //needed in some animations
property int thicknessNormal: metrics.mask.screenEdge + Math.max(metrics.totals.thickness + metrics.extraThicknessForNormal, background.thickness + background.shadows.headThickness)
property int thicknessZoom: metrics.mask.screenEdge + ((metrics.totals.thickness+extraZoomThickMask) * parabolic.factor.maxZoom) + 2
property int thicknessZoom: metrics.mask.screenEdge + ((metrics.totals.thickness+metrics.extraThicknessForZoomed) * parabolic.factor.maxZoom) + 2
//it is used to keep thickness solid e.g. when iconSize changes from auto functions
property int thicknessMidOriginal: metrics.mask.screenEdge + Math.max(thicknessNormalOriginal,extraNormalThickMask + (1 + (0.65 * (parabolic.factor.maxZoom-1)))*(metrics.maxIconSize+metrics.margin.maxThickness)) //needed in some animations
property int thicknessMidOriginal: metrics.mask.screenEdge + Math.max(thicknessNormalOriginal,metrics.extraThicknessForNormal + (1 + (0.65 * (parabolic.factor.maxZoom-1)))*(metrics.maxIconSize+metrics.margin.maxThickness)) //needed in some animations
property int thicknessNormalOriginal: metrics.mask.screenEdge + metrics.maxIconSize + (metrics.margin.maxThickness * 2) //this way we always have the same thickness published at all states
/*property int thicknessNormalOriginal: !root.behaveAsPlasmaPanel || root.editMode ?
thicknessNormalOriginalValue : background.thickness + background.shadows.headThickness*/
property int thicknessNormalOriginalValue: metrics.mask.screenEdge + metrics.maxIconSize + (metrics.margin.maxThickness * 2) + extraNormalThickMask
property int thicknessZoomOriginal: metrics.mask.maxScreenEdge + Math.max( ((metrics.maxIconSize+(metrics.margin.maxThickness * 2)) * parabolic.factor.maxZoom) + extraZoomThickMask,
property int thicknessNormalOriginalValue: metrics.mask.screenEdge + metrics.maxIconSize + (metrics.margin.maxThickness * 2) + metrics.extraThicknessForNormal
property int thicknessZoomOriginal: metrics.mask.maxScreenEdge + Math.max( ((metrics.maxIconSize+(metrics.margin.maxThickness * 2)) * parabolic.factor.maxZoom) + metrics.extraThicknessForZoomed,
background.thickness + background.shadows.headThickness)
//! when Latte behaves as Plasma panel
property int thicknessAsPanel: metrics.totals.thickness
//! is used to increase the mask thickness
readonly property int marginBetweenContentsAndEditRuler: 10
property int extraNormalThickMask: Math.max(metrics.mask.thickness.extraFromIndicators, metrics.mask.thickness.extraFromShadows)
property int extraZoomThickMask: marginBetweenContentsAndEditRuler + Math.max(metrics.mask.thickness.extraFromIndicators, metrics.mask.thickness.extraFromShadows)
property Item applets: null
@ -131,7 +125,7 @@ Item{
return 0;
}
return thicknessZoomOriginal - thicknessNormalOriginalValue + extraNormalThickMask;
return thicknessZoomOriginal - thicknessNormalOriginalValue + metrics.extraThicknessForNormal;
}
}

@ -58,6 +58,39 @@ ContainerAbility.Metrics {
//! based on background / plasma theme minimum thickness requirements; behaveAsPlasmaPanel and floating is a good scenario for this
readonly property int marginMinThickness: Math.max(0, (background.totals.minThickness - _maxIconSize) / 2)
//! Thickness Private Calculations
readonly property int marginBetweenContentsAndEditRuler: 10
readonly property int extraThicknessForNormal: Math.max(extraThicknessFromIndicators, extraThicknessFromShadows)
readonly property int extraThicknessForZoomed: marginBetweenContentsAndEditRuler + extraThicknessForNormal
readonly property int extraThicknessFromShadows: {
if (LatteCore.WindowSystem.isPlatformWayland) {
return 0;
}
//! 45% of max shadow size in px.
var shadowMaxNeededMargin = 0.45 * root.appShadowSizeOriginal;
var shadowOpacity = (plasmoid.configuration.shadowOpacity) / 100;
//! +40% of shadow opacity in percentage
shadowOpacity = shadowOpacity + shadowOpacity*0.4;
//! This way we are trying to calculate how many pixels are needed in order for the shadow
//! to be drawn correctly without being cut of from View::mask() under X11
shadowMaxNeededMargin = (shadowMaxNeededMargin * shadowOpacity);
//! give some more space when items shadows are enabled and extremely big
if (root.enableShadows && metrics.margin.maxThickness < shadowMaxNeededMargin) {
return shadowMaxNeededMargin - metrics.margin.maxThickness;
}
return 0;
}
readonly property int extraThicknessFromIndicators: indicators.info.extraMaskThickness
//! BEHAVIORS
Behavior on iconSize {
NumberAnimation {
@ -95,35 +128,6 @@ ContainerAbility.Metrics {
}
}
mask {
thickness {
readonly property int extraFromShadows: {
if (LatteCore.WindowSystem.isPlatformWayland) {
return 0;
}
//! 45% of max shadow size in px.
var shadowMaxNeededMargin = 0.45 * root.appShadowSizeOriginal;
var shadowOpacity = (plasmoid.configuration.shadowOpacity) / 100;
//! +40% of shadow opacity in percentage
shadowOpacity = shadowOpacity + shadowOpacity*0.4;
//! This way we are trying to calculate how many pixels are needed in order for the shadow
//! to be drawn correctly without being cut of from View::mask() under X11
shadowMaxNeededMargin = (shadowMaxNeededMargin * shadowOpacity);
//! give some more space when items shadows are enabled and extremely big
if (root.enableShadows && metrics.margin.maxThickness < shadowMaxNeededMargin) {
return shadowMaxNeededMargin - metrics.margin.maxThickness;
}
return 0;
}
readonly property int extraFromIndicators: indicators.info.extraMaskThickness
}
}
padding {
Behavior on length {
NumberAnimation {

@ -67,7 +67,7 @@ MouseArea {
property int appletX
property int appletY
readonly property int thickness: visibilityManager.thicknessNormalOriginalValue - visibilityManager.extraNormalThickMask
readonly property int thickness: visibilityManager.thicknessNormalOriginalValue - metrics.extraThicknessForNormal
readonly property int spacerHandleSize: units.smallSpacing
onHeightChanged: tooltip.visible = false;

@ -29,10 +29,7 @@ Item {
property int maxMedium: 48
property int maxZoomed: 48
property int maxNormalWithExtras: 48
property int maxMediumWithExtras: 48
property int maxZoomedWithExtras: 48
property int extrasForNormal: 0
property int extrasForZoomed: 0
property int maxNormalForItems: 48
property int maxMediumForItems: 48
property int maxZoomedForItems: 48
}

Loading…
Cancel
Save