From 1f33b17c03fcf92de2cd85bbfe2428210dd5c559 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sat, 11 Feb 2017 19:08:48 +0200 Subject: [PATCH] fixes for panel background metrics --- containment/contents/ui/PanelBox.qml | 37 ++++++++++++++++++++-------- containment/contents/ui/main.qml | 4 +-- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/containment/contents/ui/PanelBox.qml b/containment/contents/ui/PanelBox.qml index d309d03c5..7cc3a7629 100644 --- a/containment/contents/ui/PanelBox.qml +++ b/containment/contents/ui/PanelBox.qml @@ -33,17 +33,34 @@ import org.kde.latte 0.1 as Latte Item{ id:barLine + width: root.isHorizontal ? panelWidth : smallSize + height: root.isVertical ? panelHeight : smallSize + opacity: root.useThemePanel ? 1 : 0 - property int panelWidth: root.drawShadowsExternal ? root.width : - (root.panelAlignment === Latte.Dock.Justify) && root.isHorizontal && !root.editMode ? - layoutsContainer.contentWidth + spacing : mainLayout.width + spacing - property int panelHeight: root.drawShadowsExternal ? root.height : - (root.panelAlignment === Latte.Dock.Justify) && root.isVertical && !root.editMode ? - layoutsContainer.contentHeight + spacing : mainLayout.height + spacing + property int panelWidth: { + if (root.drawShadowsExternal) { + return root.width; + } else { + if ((root.panelAlignment === Latte.Dock.Justify) && root.isHorizontal && !root.editMode) { + return root.maxLength; + } else { + return mainLayout.width + spacing; + } + } + } - width: root.isHorizontal ? panelWidth : smallSize - height: root.isVertical ? panelHeight : smallSize + property int panelHeight: { + if (root.drawShadowsExternal) { + return root.height; + } else { + if ((root.panelAlignment === Latte.Dock.Justify) && root.isVertical && !root.editMode) { + return root.maxLength; + } else { + return mainLayout.height + spacing; + } + } + } property int spacing: (root.panelAlignment === Latte.Dock.Center || plasmoid.configuration.panelPosition === Latte.Dock.Justify) ? @@ -82,8 +99,8 @@ Item{ PlasmaCore.FrameSvgItem{ id: shadowsSvgItem - width: root.isVertical ? panelSize + marginsWidth : parent.width + marginsWidth - height: root.isVertical ? parent.height + marginsHeight : panelSize + marginsHeight + width: root.isVertical ? panelSize + marginsWidth : Math.min(parent.width + marginsWidth, root.width - marginsWidth) + height: root.isVertical ? Math.min(parent.height + marginsHeight, root.height - marginsHeight) : panelSize + marginsHeight imagePath: root.drawShadowsExternal ? "" : "widgets/panel-background" prefix: root.drawShadowsExternal ? "" : "shadow" diff --git a/containment/contents/ui/main.qml b/containment/contents/ui/main.qml index ea86ddd81..caf2b8b4c 100644 --- a/containment/contents/ui/main.qml +++ b/containment/contents/ui/main.qml @@ -1129,7 +1129,7 @@ DragDrop.DropArea { property int hoveredIndex: -1 x: { - if ( (plasmoid.configuration.panelPosition === Latte.Dock.Justify) && root.isHorizontal + if ( dock && (plasmoid.configuration.panelPosition === Latte.Dock.Justify) && root.isHorizontal && !root.editMode && windowSystem.compositingActive && !root.drawShadowsExternal ){ return ((dock.width/2) - (root.maxLength/2)) } else { @@ -1146,7 +1146,7 @@ DragDrop.DropArea { } y: { - if ( (plasmoid.configuration.panelPosition === Latte.Dock.Justify) && root.isVertical + if ( dock && (plasmoid.configuration.panelPosition === Latte.Dock.Justify) && root.isVertical && !root.editMode && windowSystem.compositingActive && !root.drawShadowsExternal ) { return ((dock.height/2) - (root.maxLength/2)); } else {