From 234de12211818ed09eb24cb84dd206a8533d2745 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Tue, 31 Jan 2017 17:42:26 +0200 Subject: [PATCH] more improvements in shadows and mask calculations --- containment/contents/ui/AppletItem.qml | 4 +-- containment/contents/ui/PanelBox.qml | 12 ++----- containment/contents/ui/VisibilityManager.qml | 34 +++++++++++-------- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/containment/contents/ui/AppletItem.qml b/containment/contents/ui/AppletItem.qml index 3a1f6ba05..8f984b024 100644 --- a/containment/contents/ui/AppletItem.qml +++ b/containment/contents/ui/AppletItem.qml @@ -421,7 +421,7 @@ Item { layoutHeight = root.iconSize + moreHeight; } else if(applet && applet.pluginName === "org.kde.plasma.systemtray" && root.isHorizontal){ - layoutHeight = root.iconSize+root.iconMargin+root.statesLineSize/2; + layoutHeight = root.statesLineSize + root.iconSize; } else{ if(applet && (applet.Layout.minimumHeight > root.iconSize) && root.isVertical && (!canBeHovered)){ @@ -465,7 +465,7 @@ Item { layoutWidth = root.iconSize + moreWidth; } else if(applet && applet.pluginName === "org.kde.plasma.systemtray" && root.isVertical){ - layoutWidth = root.iconSize+root.iconMargin+root.statesLineSize/2; + layoutWidth = root.statesLineSize + root.iconSize; } else{ if(applet && (applet.Layout.minimumWidth > root.iconSize) && root.isHorizontal && (!canBeHovered)){ diff --git a/containment/contents/ui/PanelBox.qml b/containment/contents/ui/PanelBox.qml index 1d76259f0..fefcb9931 100644 --- a/containment/contents/ui/PanelBox.qml +++ b/containment/contents/ui/PanelBox.qml @@ -95,9 +95,9 @@ Item{ opacity: root.useThemePanel ? 1 : 0 visible: (opacity == 0) ? false : true - property int panelSize: automaticPanelSize + root.panelShadow + property int panelSize: automaticPanelSize - property int automaticPanelSize: Math.min(root.themePanelSize, root.iconSize + root.iconMargin + root.statesLineSize/2) + property int automaticPanelSize: Math.min(root.themePanelSize + root.panelShadow, root.statesLineSize + root.iconSize + root.iconMargin) property int shadowsSize: shadowsSvgItem && root.useThemePanel ? (root.isVertical ? shadowsSvgItem.margins.right : shadowsSvgItem.margins.bottom) : 0 @@ -117,13 +117,7 @@ Item{ target: root property: "realPanelSize" when: shadowsSvgItem - value: { - var space = ((plasmoid.location === PlasmaCore.Types.BottomEdge) || - (plasmoid.location === PlasmaCore.Types.TopEdge)) ? - belower.height : belower.width - - return shadowsSvgItem.panelSize + space; - } + value: shadowsSvgItem.panelSize } diff --git a/containment/contents/ui/VisibilityManager.qml b/containment/contents/ui/VisibilityManager.qml index dda9ec1c4..507be70db 100644 --- a/containment/contents/ui/VisibilityManager.qml +++ b/containment/contents/ui/VisibilityManager.qml @@ -40,6 +40,7 @@ Item{ property bool inStartup: root.inStartup property bool normalState : false // this is being set from updateMaskArea property bool previousNormalState : false // this is only for debugging purposes + property bool panelIsBiggerFromIconSize: root.realPanelSize+root.panelShadow > root.statesLineSize + root.iconSize + root.iconMargin + 1 property int animationSpeed: root.durationTime * 1.2 * units.longDuration property int length: root.isVertical ? Screen.height : Screen.width //screenGeometry.height : screenGeometry.width @@ -51,14 +52,14 @@ Item{ property int thicknessAutoHidden: 2 property int thicknessMid: root.statesLineSize + (1 + (0.65 * (root.zoomFactor-1)))*(root.iconSize+root.iconMargin) //needed in some animations - property int thicknessNormal: Math.max(root.statesLineSize + root.iconSize + root.iconMargin + root.panelShadow + 1, root.realPanelSize) + property int thicknessNormal: Math.max(root.statesLineSize + root.iconSize + root.iconMargin + 1, root.realPanelSize + root.panelShadow) property int thicknessZoom: root.statesLineSize + ((root.iconSize+root.iconMargin) * root.zoomFactor) + 2 //it is used to keep thickness solid e.g. when iconSize changes from auto functions property int thicknessMidOriginal: statesLineSizeOriginal + (1 + (0.65 * (root.zoomFactor-1)))*(plasmoid.configuration.iconSize+iconMarginOriginal) //needed in some animations - property int thicknessNormalOriginal: Math.max(thicknessNormalOriginalValue, root.realPanelSize) - property int thicknessNormalOriginalValue: statesLineSizeOriginal + plasmoid.configuration.iconSize + iconMarginOriginal + root.panelShadow + 1 - property int thicknessZoomOriginal: Math.max(statesLineSizeOriginal + ((plasmoid.configuration.iconSize+iconMarginOriginal) * root.zoomFactor) + root.panelShadow + 2, - root.realPanelSize+root.editShadow) + property int thicknessNormalOriginal: Math.max(thicknessNormalOriginalValue, root.realPanelSize + root.panelShadow) + property int thicknessNormalOriginalValue: statesLineSizeOriginal + plasmoid.configuration.iconSize + iconMarginOriginal + 1 + property int thicknessZoomOriginal: Math.max(statesLineSizeOriginal + ((plasmoid.configuration.iconSize+iconMarginOriginal) * root.zoomFactor) + 2, + root.realPanelSize + root.panelShadow) Binding{ target: dock @@ -266,21 +267,24 @@ Item{ //console.log("update mask area:"+newMaskArea); if(normalState && !dock.visibility.isHidden){ + //the shadows size must be removed from the maskArea //before updating the localDockGeometry - var shadow = root.panelShadow; + if(panelIsBiggerFromIconSize) { + var shadow = root.panelShadow; - if (plasmoid.formFactor === PlasmaCore.Types.Vertical) { - newMaskArea.width = newMaskArea.width - shadow - 1; - } else { - newMaskArea.height = newMaskArea.height - shadow - 1; - } + if (plasmoid.formFactor === PlasmaCore.Types.Vertical) { + newMaskArea.width = newMaskArea.width - shadow; + } else { + newMaskArea.height = newMaskArea.height - shadow; + } - if (plasmoid.location === PlasmaCore.Types.BottomEdge) { - newMaskArea.y = newMaskArea.y + shadow; - } else if (plasmoid.location === PlasmaCore.Types.RightEdge) { - newMaskArea.x = newMaskArea.x + shadow; + if (plasmoid.location === PlasmaCore.Types.BottomEdge) { + newMaskArea.y = newMaskArea.y + shadow; + } else if (plasmoid.location === PlasmaCore.Types.RightEdge) { + newMaskArea.x = newMaskArea.x + shadow; + } } dock.setLocalDockGeometry(newMaskArea);