From a84f19e90630accd828ec8ef9379ec26a953d77b Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Tue, 31 Jan 2017 16:38:47 +0200 Subject: [PATCH] improve semantics for shadows --- containment/contents/ui/EditModeVisual.qml | 9 ++++----- containment/contents/ui/PanelBox.qml | 4 ++-- containment/contents/ui/VisibilityManager.qml | 14 +++++++------- containment/contents/ui/main.qml | 7 ++++--- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/containment/contents/ui/EditModeVisual.qml b/containment/contents/ui/EditModeVisual.qml index f6f64ed68..3b5b62d3e 100644 --- a/containment/contents/ui/EditModeVisual.qml +++ b/containment/contents/ui/EditModeVisual.qml @@ -35,9 +35,8 @@ Image{ opacity: 0 property int speed: root.durationTime*4*units.longDuration - property int thickness: visibilityManager.thicknessNormalOriginal + shadowSize - property int rootThickness: visibilityManager.thicknessZoomOriginal + shadowSize - property int shadowSize : Math.ceil(root.iconSize / 5) + property int thickness: visibilityManager.thicknessNormalOriginal + root.editShadow + property int rootThickness: visibilityManager.thicknessZoomOriginal + root.editShadow property bool animationSent: false property bool farEdge: (plasmoid.location===PlasmaCore.Types.BottomEdge) || (plasmoid.location===PlasmaCore.Types.RightEdge) @@ -45,7 +44,7 @@ Image{ layer.enabled: true layer.effect: DropShadow { - radius: editVisual.shadowSize + radius: root.editShadow samples: 2 * radius color: "#ee080808" } @@ -78,7 +77,7 @@ Image{ onEditAnimationEndedChanged: { if (editAnimationEnded) { - dock.shadow = shadowSize; + dock.shadow = root.editShadow; } else { dock.shadow = 0; } diff --git a/containment/contents/ui/PanelBox.qml b/containment/contents/ui/PanelBox.qml index 370175bcb..1d76259f0 100644 --- a/containment/contents/ui/PanelBox.qml +++ b/containment/contents/ui/PanelBox.qml @@ -95,7 +95,7 @@ Item{ opacity: root.useThemePanel ? 1 : 0 visible: (opacity == 0) ? false : true - property int panelSize: automaticPanelSize + root.shadowsSize + property int panelSize: automaticPanelSize + root.panelShadow property int automaticPanelSize: Math.min(root.themePanelSize, root.iconSize + root.iconMargin + root.statesLineSize/2) @@ -108,7 +108,7 @@ Item{ Binding { target: root - property: "shadowsSize" + property: "panelShadow" when: shadowsSvgItem value: shadowsSvgItem.shadowsSize } diff --git a/containment/contents/ui/VisibilityManager.qml b/containment/contents/ui/VisibilityManager.qml index 6eef15589..dda9ec1c4 100644 --- a/containment/contents/ui/VisibilityManager.qml +++ b/containment/contents/ui/VisibilityManager.qml @@ -51,14 +51,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.shadowsSize + 1, root.realPanelSize) + property int thicknessNormal: Math.max(root.statesLineSize + root.iconSize + root.iconMargin + root.panelShadow + 1, root.realPanelSize) 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.shadowsSize + 1 - property int thicknessZoomOriginal: Math.max(statesLineSizeOriginal + ((plasmoid.configuration.iconSize+iconMarginOriginal) * root.zoomFactor) + root.shadowsSize + 2, - root.realPanelSize+editModeVisual.shadowSize) + 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) Binding{ target: dock @@ -140,7 +140,7 @@ Item{ var tempThickness = root.isHorizontal ? height : width; var space = root.useThemePanel ? (plasmoid.configuration.panelPosition === Latte.Dock.Justify) ? - root.panelEdgeSpacing + 2*root.shadowsSize : root.panelEdgeSpacing + 2*root.shadowsSize : 2; + root.panelEdgeSpacing + 2*root.panelShadow : root.panelEdgeSpacing + 2*root.panelShadow : 2; if (normalState) { //console.log("entered normal state..."); @@ -208,7 +208,7 @@ Item{ //this is used to fix a bug with shadow showing when the animation of edit mode //is triggered - var editModeThickness = editModeVisual.editAnimationEnded ? thicknessNormalOriginal + editModeVisual.shadowSize : + var editModeThickness = editModeVisual.editAnimationEnded ? thicknessNormalOriginal + root.editShadow : thicknessNormalOriginal tempThickness = root.editMode ? editModeThickness : thicknessNormalOriginal; @@ -269,7 +269,7 @@ Item{ //the shadows size must be removed from the maskArea //before updating the localDockGeometry - var shadow = root.shadowsSize; + var shadow = root.panelShadow; if (plasmoid.formFactor === PlasmaCore.Types.Vertical) { newMaskArea.width = newMaskArea.width - shadow - 1; diff --git a/containment/contents/ui/main.qml b/containment/contents/ui/main.qml index 3323e5d66..7c1f9eb49 100644 --- a/containment/contents/ui/main.qml +++ b/containment/contents/ui/main.qml @@ -80,10 +80,11 @@ DragDrop.DropArea { property int realSize: iconSize + iconMargin property int realPanelSize //this is set by the PanelBox - property int shadowsSize: 0 + property int panelShadow: 0 //shadowsSize + property int editShadow: Math.ceil(iconSize / 5) property int themePanelSize: plasmoid.configuration.panelSize - property int iconMargin: 0.12 * iconSize + property int iconMargin: Math.ceil(0.12 * iconSize) property int statesLineSize: nowDock ? Math.ceil( root.iconSize/13 ) : 0 @@ -454,7 +455,7 @@ DragDrop.DropArea { } } - onShadowsSizeChanged: { + onPanelShadowChanged: { visibilityManager.updateMaskArea(); }