From 9760ef2a5e0038e7fd700f0f0b32d818243df613 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Fri, 11 Aug 2017 02:47:47 +0300 Subject: [PATCH] follow Fitt's Law when dock is inFullJustify --improvements in order to follow Fitt's Law when the dock is in Justify mode and 100% maximum length --- containment/package/contents/ui/applet/AppletItem.qml | 2 ++ containment/package/contents/ui/applet/AppletItemWrapper.qml | 4 ++-- containment/package/contents/ui/main.qml | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/containment/package/contents/ui/applet/AppletItem.qml b/containment/package/contents/ui/applet/AppletItem.qml index a365b0d14..6fe03a0d3 100644 --- a/containment/package/contents/ui/applet/AppletItem.qml +++ b/containment/package/contents/ui/applet/AppletItem.qml @@ -63,6 +63,8 @@ Item { property bool isZoomed: false property bool isSeparator: applet && applet.pluginName === "audoban.applet.separator" + property bool firstChildOfStartLayout: (index === layoutsContainer.startLayout.beginIndex) + property bool lastChildOfEndLayout: ((index === layoutsContainer.endLayout.beginIndex+layoutsContainer.endLayout.count-1)&&(layoutsContainer.endLayout.count>1)) //applet is in starting edge /*property bool startEdge: index < layoutsContainer.endLayout.beginIndex ? (index === 0)&&(layoutsContainer.mainLayout.count > 1) : (index === layoutsContainer.endLayout.beginIndex)&&(layoutsContainer.endLayout.count > 1)*/ diff --git a/containment/package/contents/ui/applet/AppletItemWrapper.qml b/containment/package/contents/ui/applet/AppletItemWrapper.qml index 7b9c6f8ed..f3d842ac0 100644 --- a/containment/package/contents/ui/applet/AppletItemWrapper.qml +++ b/containment/package/contents/ui/applet/AppletItemWrapper.qml @@ -111,10 +111,10 @@ Item{ property int marginWidth: root.isVertical ? (applet && (applet.pluginName === "org.kde.plasma.systemtray") ? root.thickMarginBase : root.thickMargin ) : - root.iconMargin + (root.inFullJustify && (container.firstChildOfStartLayout || container.lastChildOfEndLayout ) ? 0 : root.iconMargin) //Fitt's Law property int marginHeight: root.isHorizontal ? (applet && (applet.pluginName === "org.kde.plasma.systemtray") ? root.thickMarginBase : root.thickMargin ) : - root.iconMargin + (root.inFullJustify && (container.firstChildOfStartLayout || container.lastChildOfEndLayout ) ? 0 : root.iconMargin) //Fitt's Law property real scaledWidth: zoomScaleWidth * (layoutWidth + marginWidth) property real scaledHeight: zoomScaleHeight * (layoutHeight + marginHeight) diff --git a/containment/package/contents/ui/main.qml b/containment/package/contents/ui/main.qml index c992ec1d4..68a810aec 100644 --- a/containment/package/contents/ui/main.qml +++ b/containment/package/contents/ui/main.qml @@ -85,6 +85,7 @@ DragDrop.DropArea { property bool immutable: plasmoid.immutable property bool indicateAudioStreams: plasmoid.configuration.indicateAudioStreams + property bool inFullJustify: (plasmoid.configuration.panelPosition === Latte.Dock.Justify) && (plasmoid.configuration.maxLength===100) property bool inStartup: true property bool isHalfShown: false //is used to disable the zoom hovering effect at sliding in-out the dock property bool isHorizontal: plasmoid.formFactor === PlasmaCore.Types.Horizontal @@ -188,8 +189,8 @@ DragDrop.DropArea { //decouple iconMargin which now is used only for length calculations with thickMargins //which are used for thickness calculations - property int thickMarginBase: shrinkThickMargins ? 1 : Math.ceil(0.06 * iconSize) - property int thickMarginHigh: shrinkThickMargins ? 1 : Math.ceil(0.06 * iconSize) + property int thickMarginBase: shrinkThickMargins ? 0 : Math.ceil(0.06 * iconSize) + property int thickMarginHigh: shrinkThickMargins ? 0 : Math.ceil(0.06 * iconSize) property int thickMargin: thickMarginBase + thickMarginHigh //it is used in order to not break the calculations for the thickness placement