From fb026b1cac40f7155ebd2cbe64ee153bb2f14b43 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sun, 8 Sep 2019 03:06:02 +0300 Subject: [PATCH] multiple fixes for different margins --multiple fixes for margins all over the place. More specific how they are calculated and when they are used --- .../package/contents/ui/applet/AppletItem.qml | 21 ++++++++++++++++++- .../contents/ui/applet/HiddenSpacer.qml | 4 ++-- .../contents/ui/applet/ItemWrapper.qml | 8 +++---- .../contents/ui/applet/indicator/Loader.qml | 13 ++++-------- .../contents/ui/indicators/Manager.qml | 2 +- containment/package/contents/ui/main.qml | 16 +------------- .../package/contents/ui/task/IconItem.qml | 2 +- 7 files changed, 33 insertions(+), 33 deletions(-) diff --git a/containment/package/contents/ui/applet/AppletItem.qml b/containment/package/contents/ui/applet/AppletItem.qml index de2098622..f5e7b1a69 100644 --- a/containment/package/contents/ui/applet/AppletItem.qml +++ b/containment/package/contents/ui/applet/AppletItem.qml @@ -131,9 +131,21 @@ Item { property int previousIndex: -1 property int sizeForFill: -1 //it is used in calculations for fillWidth,fillHeight applets - property int spacersMaxSize: Math.max(0,Math.ceil(0.55 * root.iconSize) - root.lengthAppletMargins) + property int spacersMaxSize: Math.max(0,Math.ceil(0.55 * root.iconSize) - root.lengthMargins) property int status: applet ? applet.status : -1 + //! local margins + readonly property bool parabolicEffectMarginsEnabled: root.zoomFactor>1 && !originalAppletBehavior + + property int lengthAppletIntMargin: root.lengthAppletIntMarginFactor === -1 || parabolicEffectMarginsEnabled ? + root.lengthIntMargin : root.lengthAppletIntMarginFactor * root.iconSize + + property int lengthAppletFullMargin: lengthAppletIntMargin + root.lengthExtMargin + property int lengthAppletFullMargins: 2 * lengthAppletFullMargin + + property int internalWidthMargins: root.isVertical ? root.thickMargins : 2 * lengthAppletIntMargin + property int internalHeightMargins: root.isHorizontal ? root.thickMargins : 2 * lengthAppletIntMargin + //! are set by the indicator property int iconOffsetX: 0 property int iconOffsetY: 0 @@ -236,6 +248,13 @@ Item { to: 0 } + Behavior on lengthAppletIntMargin { + NumberAnimation { + duration: 0.8 * root.animationTime + easing.type: Easing.OutCubic + } + } + //// END :: Animate Applet when a new applet is dragged in the view /// BEGIN functions diff --git a/containment/package/contents/ui/applet/HiddenSpacer.qml b/containment/package/contents/ui/applet/HiddenSpacer.qml index 49feda4bb..58e1943c5 100644 --- a/containment/package/contents/ui/applet/HiddenSpacer.qml +++ b/containment/package/contents/ui/applet/HiddenSpacer.qml @@ -45,9 +45,9 @@ Item{ property bool rightSpacer: false - readonly property bool atEdgeForcingFittsLaw: !isSeparator && !root.parabolicEffectEnabled && root.inFullJustify && atScreenEdge && !isSquare + readonly property bool atEdgeForcingFittsLaw: !isSeparator && !parabolicEffectMarginsEnabled && atScreenEdge readonly property int subtrackedMargins: atEdgeForcingFittsLaw && ((startEdge && rightSpacer) || (endEdge && !rightSpacer )) ? - root.lengthAppletIntMargin + root.lengthExtMargin : 0 + root.lengthExtMargin : 0 property real nScale: 0 diff --git a/containment/package/contents/ui/applet/ItemWrapper.qml b/containment/package/contents/ui/applet/ItemWrapper.qml index d6fbc2e1d..4323c03ed 100644 --- a/containment/package/contents/ui/applet/ItemWrapper.qml +++ b/containment/package/contents/ui/applet/ItemWrapper.qml @@ -117,13 +117,13 @@ Item{ property int marginWidth: root.isVertical ? root.thickMargins : - (root.inFullJustify && atScreenEdge ? edgeLengthMargins : localLengthMargins) //Fitt's Law + (root.inFullJustify && atScreenEdge && !parabolicEffectMarginsEnabled ? edgeLengthMargins : localLengthMargins) //Fitt's Law property int marginHeight: root.isHorizontal ? root.thickMargins : - (root.inFullJustify && atScreenEdge ? edgeLengthMargins : localLengthMargins) //Fitt's Law + (root.inFullJustify && atScreenEdge && !parabolicEffectMarginsEnabled ? edgeLengthMargins : localLengthMargins) //Fitt's Law - property int localLengthMargins: isSeparator || !communicator.lengthMarginsEnabled ? 0 : root.lengthAppletMargins - property int edgeLengthMargins: isSeparator || !communicator.lengthMarginsEnabled || !isSquare ? 0 : root.lengthAppletMargins + property int localLengthMargins: isSeparator || !communicator.lengthMarginsEnabled ? 0 : appletItem.lengthAppletFullMargins + property int edgeLengthMargins: isSeparator || !communicator.lengthMarginsEnabled || !isSquare ? 0 : appletItem.lengthAppletIntMargin * 2 property real scaledWidth: zoomScaleWidth * (layoutWidth + marginWidth) property real scaledHeight: zoomScaleHeight * (layoutHeight + marginHeight) diff --git a/containment/package/contents/ui/applet/indicator/Loader.qml b/containment/package/contents/ui/applet/indicator/Loader.qml index 8373d8ae1..c043625f0 100644 --- a/containment/package/contents/ui/applet/indicator/Loader.qml +++ b/containment/package/contents/ui/applet/indicator/Loader.qml @@ -42,18 +42,13 @@ Loader { return indicators.indicatorComponent; } - width: root.isHorizontal && !(root.inFullJustify && atScreenEdge /*Fitt's Law*/ && !isSquare) && canBeHovered ? - appletItem.wrapperAlias.width - 2*appletItem.wrapperAlias.zoomScale*root.lengthExtMargin - : appletItem.wrapperAlias.width - - height: root.isVertical && !(root.inFullJustify && atScreenEdge /*Fitt's Law*/ && !isSquare) && canBeHovered ? - appletItem.wrapperAlias.height - 2*appletItem.wrapperAlias.zoomScale*root.lengthExtMargin : - appletItem.wrapperAlias.height + width: root.isHorizontal && canBeHovered ? appletItem.wrapperAlias.zoomScale * visualLockedWidth : appletItem.wrapperAlias.width + height: root.isVertical && canBeHovered ? appletItem.wrapperAlias.zoomScale * visualLockedHeight : appletItem.wrapperAlias.height readonly property bool locked: appletItem.lockZoom || root.zoomFactor === 1 - property real visualLockedWidth: root.iconSize + root.internalWidthMargins - property real visualLockedHeight: root.iconSize + root.internalHeightMargins + property real visualLockedWidth: root.iconSize + appletItem.internalWidthMargins + property real visualLockedHeight: root.iconSize + appletItem.internalHeightMargins //! Communications !// diff --git a/containment/package/contents/ui/indicators/Manager.qml b/containment/package/contents/ui/indicators/Manager.qml index d44e2f910..07a081807 100644 --- a/containment/package/contents/ui/indicators/Manager.qml +++ b/containment/package/contents/ui/indicators/Manager.qml @@ -49,7 +49,7 @@ Item{ readonly property bool needsMouseEventCoordinates: infoLoaded && metricsLoader.item.hasOwnProperty("needsMouseEventCoordinates") && metricsLoader.item.needsMouseEventCoordinates - readonly property bool providesFrontLayer: minfoLoaded && metricsLoader.item.hasOwnProperty("providesFrontLayer") + readonly property bool providesFrontLayer: infoLoaded && metricsLoader.item.hasOwnProperty("providesFrontLayer") && metricsLoader.item.providesFrontLayer readonly property bool providesHoveredAnimation: infoLoaded && metricsLoader.item.hasOwnProperty("providesHoveredAnimation") diff --git a/containment/package/contents/ui/main.qml b/containment/package/contents/ui/main.qml index 87de38fe9..1b34e05b2 100644 --- a/containment/package/contents/ui/main.qml +++ b/containment/package/contents/ui/main.qml @@ -383,8 +383,7 @@ Item { property real lengthIntMarginFactor: indicators.isEnabled ? indicators.padding : 0 property real lengthExtMarginFactor: plasmoid.configuration.lengthExtMargin / 100 - property int lengthAppletIntMargin: lengthAppletIntMarginFactor === -1 ? lengthIntMargin : lengthAppletIntMarginFactor * root.iconSize - property real lengthAppletIntMarginFactor: indicators.infoLoaded && !parabolicEffectEnabled ? indicators.info.appletLengthPadding : -1 + property real lengthAppletIntMarginFactor: indicators.infoLoaded ? indicators.info.appletLengthPadding : -1 property real thickMarginFactor: { if (shrinkThickMargins) { @@ -407,15 +406,9 @@ Item { property int lengthMargin: lengthIntMargin + lengthExtMargin property int lengthMargins: 2 * lengthMargin - property int lengthAppletMargin: lengthAppletIntMargin + lengthExtMargin - property int lengthAppletMargins: 2 * lengthAppletIntMargin - property int widthMargins: root.isVertical ? thickMargins : lengthMargins property int heightMargins: root.isHorizontal ? thickMargins : lengthMargins - property int internalWidthMargins: root.isVertical ? thickMargins : 2 * lengthAppletMargin - property int internalHeightMargins: root.isHorizontal ? thickMargins : 2 * lengthAppletMargin - ///FIXME: I can't remember why this is needed, maybe for the anchorings!!! In order for the Double Layout to not mess the anchorings... //property int layoutsContainer.mainLayoutPosition: !plasmoid.immutable ? Latte.Types.Center : (root.isVertical ? Latte.Types.Top : Latte.Types.Left) //property int panelAlignment: plasmoid.configuration.panelPosition !== Latte.Types.Justify ? plasmoid.configuration.panelPosition : layoutsContainer.mainLayoutPosition @@ -619,13 +612,6 @@ Item { } } - Behavior on lengthAppletIntMargin { - NumberAnimation { - duration: 0.8 * root.animationTime - easing.type: Easing.OutCubic - } - } - Behavior on lengthExtMargin { NumberAnimation { duration: 0.8 * root.animationTime diff --git a/plasmoid/package/contents/ui/task/IconItem.qml b/plasmoid/package/contents/ui/task/IconItem.qml index 79efafbba..4b246a857 100644 --- a/plasmoid/package/contents/ui/task/IconItem.qml +++ b/plasmoid/package/contents/ui/task/IconItem.qml @@ -68,7 +68,7 @@ Item{ readonly property color backgroundColor: iconImageBuffer.backgroundColor readonly property color glowColor: iconImageBuffer.glowColor readonly property bool progressVisible: smartLauncherItem && smartLauncherItem.progressVisible - readonly property real progress: smartLauncherItem && smartLauncherItem.progress + readonly property real progress: smartLauncherItem && smartLauncherItem.progress ? smartLauncherItem.progress : 0 property QtObject buffers: null property QtObject smartLauncherItem: null