move lengthMargin(s) to Metrics ability

pull/15/head
Michail Vourlakos 5 years ago
parent dae35a12bb
commit 6259c395de

@ -450,7 +450,7 @@ function insertAtLayoutCoordinates(tLayout, item, x, y) {
if (!child) { if (!child) {
// check if dragging takes place after the end of the layout // check if dragging takes place after the end of the layout
var neededSpace = 1.5 * (metrics.iconSize + root.lengthMargin); var neededSpace = 1.5 * (metrics.iconSize + metrics.totals.lengthEdge);
if ( (((root.isVertical && (y - neededSpace) <= tLayout.height) && y>=0) if ( (((root.isVertical && (y - neededSpace) <= tLayout.height) && y>=0)
||(root.isHorizontal && (x - neededSpace) <= tLayout.width) && x>=0) ||(root.isHorizontal && (x - neededSpace) <= tLayout.width) && x>=0)
&& tLayout.children.length>0 ){ && tLayout.children.length>0 ){

@ -461,11 +461,11 @@ Window{
} }
Text{ Text{
text: "Length External Margin (pixels)"+space text: "Length Margin (pixels)"+space
} }
Text{ Text{
text: root.lengthExtMargin text: metrics.margin.length
} }
Text{ Text{

@ -165,7 +165,7 @@ Item {
layouts.startLayout.width+layouts.mainLayout.width+layouts.endLayout.width : layouts.mainLayout.width layouts.startLayout.width+layouts.mainLayout.width+layouts.endLayout.width : layouts.mainLayout.width
} }
var itemLength = metrics.iconSize + lengthMargins; var itemLength = metrics.totals.length;
var toShrinkLimit = maxLength - (root.zoomFactor * itemLength); var toShrinkLimit = maxLength - (root.zoomFactor * itemLength);
//! to grow limit must be a little less than the shrink one in order to be more robust and //! to grow limit must be a little less than the shrink one in order to be more robust and

@ -30,6 +30,7 @@ AbilityPrivate.MetricsPrivate {
iconSize: autosizeEnabled && autosize.iconSize > 0 ? Math.min(autosize.iconSize, maxIconSize) : maxIconSize iconSize: autosizeEnabled && autosize.iconSize > 0 ? Math.min(autosize.iconSize, maxIconSize) : maxIconSize
maxIconSize: portionIconSize!==-1 ? portionIconSize : plasmoid.configuration.iconSize maxIconSize: portionIconSize!==-1 ? portionIconSize : plasmoid.configuration.iconSize
margin.length: fraction.lengthMargin * iconSize
margin.thickness: fraction.thicknessMargin * iconSize margin.thickness: fraction.thicknessMargin * iconSize
margin.maxThickness: fraction.thicknessMargin * maxIconSize margin.maxThickness: fraction.thicknessMargin * maxIconSize

@ -66,6 +66,13 @@ ContainerAbility.Metrics {
} }
margin { margin {
Behavior on length {
NumberAnimation {
duration: 0.8 * animations.duration.proposed
easing.type: Easing.OutCubic
}
}
Behavior on thickness { Behavior on thickness {
NumberAnimation { NumberAnimation {
duration: 0.8 * animations.duration.proposed duration: 0.8 * animations.duration.proposed

@ -162,7 +162,7 @@ Item {
property int previousIndex: -1 property int previousIndex: -1
property int sizeForFill: -1 //it is used in calculations for fillWidth,fillHeight applets property int sizeForFill: -1 //it is used in calculations for fillWidth,fillHeight applets
property int spacersMaxSize: Math.max(0,Math.ceil(0.55 * metrics.iconSize) - root.lengthMargins) property int spacersMaxSize: Math.max(0,Math.ceil(0.55 * metrics.iconSize) - metrics.totals.lengthEdges)
property int status: applet ? applet.status : -1 property int status: applet ? applet.status : -1
//! local margins //! local margins
@ -171,7 +171,7 @@ Item {
property int lengthAppletPadding: metrics.fraction.lengthAppletPadding === -1 || parabolicEffectMarginsEnabled ? property int lengthAppletPadding: metrics.fraction.lengthAppletPadding === -1 || parabolicEffectMarginsEnabled ?
metrics.padding.length : metrics.padding.lengthApplet metrics.padding.length : metrics.padding.lengthApplet
property int lengthAppletFullMargin: lengthAppletPadding + root.lengthExtMargin property int lengthAppletFullMargin: lengthAppletPadding + metrics.margin.length
property int lengthAppletFullMargins: 2 * lengthAppletFullMargin property int lengthAppletFullMargins: 2 * lengthAppletFullMargin
property int internalWidthMargins: { property int internalWidthMargins: {

@ -35,7 +35,7 @@ Item{
property bool neighbourSeparator: false; property bool neighbourSeparator: false;
property int separatorSpace: neighbourSeparator && !appletItem.isSeparator && root.parabolicEffectEnabled property int separatorSpace: neighbourSeparator && !appletItem.isSeparator && root.parabolicEffectEnabled
&& !appletItem.latteApplet ? ((LatteCore.Environment.separatorLength/2)+root.lengthExtMargin) : subtrackedMargins && !appletItem.latteApplet ? ((LatteCore.Environment.separatorLength/2)+appletItem.metrics.margin.length) : subtrackedMargins
property real nHiddenSize: { property real nHiddenSize: {
if (isSeparator || !communicator.requires.lengthMarginsEnabled) { if (isSeparator || !communicator.requires.lengthMarginsEnabled) {
@ -50,7 +50,7 @@ Item{
readonly property bool atEdgeForcingFittsLaw: !isSeparator && !parabolicEffectMarginsEnabled && atScreenEdge readonly property bool atEdgeForcingFittsLaw: !isSeparator && !parabolicEffectMarginsEnabled && atScreenEdge
readonly property int subtrackedMargins: { readonly property int subtrackedMargins: {
if (atEdgeForcingFittsLaw && ((firstAppletInContainer && rightSpacer) || (lastAppletInContainer && !rightSpacer ))) { if (atEdgeForcingFittsLaw && ((firstAppletInContainer && rightSpacer) || (lastAppletInContainer && !rightSpacer ))) {
return (wrapperAlias.edgeLengthMarginsDisabled ? root.lengthExtMargin + appletItem.lengthAppletPadding : root.lengthExtMargin); return (wrapperAlias.edgeLengthMarginsDisabled ? appletItem.metrics.margin.length + appletItem.lengthAppletPadding : appletItem.metrics.margin.length);
} }
return 0; return 0;

@ -190,7 +190,7 @@ Item{
console.log("Icon size: " + appletItem.metrics.iconSize); console.log("Icon size: " + appletItem.metrics.iconSize);
console.log("Thick Margins: " + appletItem.metrics.totals.thicknessEdges); console.log("Thick Margins: " + appletItem.metrics.totals.thicknessEdges);
console.log("Intern. Margins: " + (appletItem.metrics.padding.length * 2)); console.log("Intern. Margins: " + (appletItem.metrics.padding.length * 2));
console.log("Intern. Margins: " + (root.lengthExtMargin * 2)); console.log("Intern. Margins: " + (appletItem.metrics.margin.length * 2));
console.log("Max hovered criteria: " + (appletItem.metrics.iconSize + metrics.totals.thicknessEdges)); console.log("Max hovered criteria: " + (appletItem.metrics.iconSize + metrics.totals.thicknessEdges));
console.log("-----"); console.log("-----");
console.log("LayoutW: " + layoutWidth); console.log("LayoutW: " + layoutWidth);

@ -386,8 +386,6 @@ Item {
return Math.max(panelBase, panelBase + percentage*maxPanelSize); return Math.max(panelBase, panelBase + percentage*maxPanelSize);
} }
property int lengthExtMargin: metrics.fraction.lengthMargin * metrics.iconSize
property bool screenEdgeMarginEnabled: plasmoid.configuration.screenEdgeMargin >= 0 && !plasmoid.configuration.shrinkThickMargins property bool screenEdgeMarginEnabled: plasmoid.configuration.screenEdgeMargin >= 0 && !plasmoid.configuration.shrinkThickMargins
property int screenEdgeMargin: { property int screenEdgeMargin: {
//! is used for window geometry calculations //! is used for window geometry calculations
@ -403,11 +401,8 @@ Item {
|| !screenEdgeMarginEnabled || !screenEdgeMarginEnabled
|| hideThickScreenGap ? 0 : plasmoid.configuration.screenEdgeMargin || hideThickScreenGap ? 0 : plasmoid.configuration.screenEdgeMargin
property int lengthMargin: metrics.padding.length + lengthExtMargin property int widthMargins: root.isVertical ? metrics.totals.thicknessEdges : metrics.totals.lengthEdges
property int lengthMargins: 2 * lengthMargin property int heightMargins: root.isHorizontal ? metrics.totals.thicknessEdges : metrics.totals.lengthEdges
property int widthMargins: root.isVertical ? metrics.totals.thicknessEdges : lengthMargins
property int heightMargins: root.isHorizontal ? metrics.totals.thicknessEdges : lengthMargins
///FIXME: <delete both> I can't remember why this is needed, maybe for the anchorings!!! In order for the Double Layout to not mess the anchorings... ///FIXME: <delete both> 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 ? LatteCore.Types.Center : (root.isVertical ? LatteCore.Types.Top : LatteCore.Types.Left) //property int layoutsContainer.mainLayoutPosition: !plasmoid.immutable ? LatteCore.Types.Center : (root.isVertical ? LatteCore.Types.Top : LatteCore.Types.Left)
@ -535,13 +530,6 @@ Item {
////////////////END properties ////////////////END properties
//// BEGIN OF Behaviors //// BEGIN OF Behaviors
Behavior on lengthExtMargin {
NumberAnimation {
duration: 0.8 * animations.duration.proposed
easing.type: Easing.OutCubic
}
}
Behavior on localScreenEdgeMargin { Behavior on localScreenEdgeMargin {
enabled: !root.behaveAsPlasmaPanel enabled: !root.behaveAsPlasmaPanel
&& !editModeVisual.editAnimationRunning /*avoid slide-out animation when from editMode we change to real floating*/ && !editModeVisual.editAnimationRunning /*avoid slide-out animation when from editMode we change to real floating*/
@ -1615,8 +1603,8 @@ Item {
width: root.isHorizontal ? length : thickness width: root.isHorizontal ? length : thickness
height: root.isHorizontal ? thickness : length height: root.isHorizontal ? thickness : length
readonly property int length: metrics.iconSize + root.lengthMargins readonly property int length: metrics.totals.length
readonly property int thickness: metrics.iconSize + metrics.totals.thicknessEdges + root.localScreenEdgeMargin readonly property int thickness: metrics.totals.thickness + root.localScreenEdgeMargin
Layout.preferredWidth: width Layout.preferredWidth: width
Layout.preferredHeight: height Layout.preferredHeight: height

@ -122,7 +122,7 @@ function insertIndexAt(above, x, y) {
} else { } else {
var distance = root.vertical ? y : x; var distance = root.vertical ? y : x;
//var step = root.vertical ? LayoutManager.taskWidth() : LayoutManager.taskHeight(); //var step = root.vertical ? LayoutManager.taskWidth() : LayoutManager.taskHeight();
var step = metrics.iconSize + root.lengthMargins; var step = metrics.totals.length;
var stripe = Math.ceil(distance / step); var stripe = Math.ceil(distance / step);
/* if (stripe === LayoutManager.calculateStripes()) { /* if (stripe === LayoutManager.calculateStripes()) {

@ -27,6 +27,7 @@ AppletAbility.Metrics {
//! Public Local Properties //! Public Local Properties
local.iconSize: Math.max(plasmoid.configuration.iconSize, 16) local.iconSize: Math.max(plasmoid.configuration.iconSize, 16)
local.margin.length: 0.1 * iconSize
local.margin.thickness: 0.16 * iconSize local.margin.thickness: 0.16 * iconSize
local.padding.length: 0.04 * iconSize local.padding.length: 0.04 * iconSize
} }

@ -107,8 +107,8 @@ Item {
property int tasksStarting: 0 property int tasksStarting: 0
///Don't use Math.floor it adds one pixel in animations and creates glitches ///Don't use Math.floor it adds one pixel in animations and creates glitches
property int widthMargins: root.vertical ? metrics.totals.thicknessEdges : lengthMargins property int widthMargins: root.vertical ? metrics.totals.thicknessEdges : metrics.totals.lengthEdges
property int heightMargins: !root.vertical ? metrics.totals.thicknessEdges : lengthMargins property int heightMargins: !root.vertical ? metrics.totals.thicknessEdges : metrics.totals.lengthEdges
property int internalWidthMargins: root.vertical ? metrics.totals.thicknessEdges : metrics.totals.lengthPaddings property int internalWidthMargins: root.vertical ? metrics.totals.thicknessEdges : metrics.totals.lengthPaddings
property int internalHeightMargins: !root.vertical ? metrics.totals.thicknessEdges : metrics.totals.lengthPaddings property int internalHeightMargins: !root.vertical ? metrics.totals.thicknessEdges : metrics.totals.lengthPaddings
@ -216,10 +216,6 @@ Item {
} }
} }
property int lengthExtMargin: latteView ? latteView.lengthExtMargin : 0.1 * metrics.iconSize
property int lengthMargin: metrics.padding.length + lengthExtMargin
property int lengthMargins: 2 * lengthMargin
property int tasksHeight: mouseHandler.height property int tasksHeight: mouseHandler.height
property int tasksWidth: mouseHandler.width property int tasksWidth: mouseHandler.width
//updated from Binding //updated from Binding
@ -1087,7 +1083,7 @@ Item {
visible: plasmoid.configuration.zoomHelper visible: plasmoid.configuration.zoomHelper
property int neededSpace: zoomFactor*(metrics.iconSize+lengthMargins) property int neededSpace: zoomFactor*metrics.totals.length
} }
Item{ Item{

@ -47,7 +47,7 @@ Item{
//! && !root.inActivityChange (deprecated) in order to check if it is fixed //! && !root.inActivityChange (deprecated) in order to check if it is fixed
property int separatorSpace: neighbourSeparator && !isSeparator && root.parabolicEffectEnabled property int separatorSpace: neighbourSeparator && !isSeparator && root.parabolicEffectEnabled
&& !(parabolicManager.hasInternalSeparator && root.dragSource) ? && !(parabolicManager.hasInternalSeparator && root.dragSource) ?
((LatteCore.Environment.separatorLength/2)+root.lengthExtMargin) : 0 ((LatteCore.Environment.separatorLength/2)+taskItem.metrics.margin.length) : 0
property bool rightSpacer: false property bool rightSpacer: false

@ -599,7 +599,7 @@ Item{
height: !root.vertical ? thickness : length height: !root.vertical ? thickness : length
anchors.centerIn: parent anchors.centerIn: parent
readonly property int length: taskItem.metrics.iconSize + root.lengthMargins readonly property int length: taskItem.metrics.totals.length
readonly property int thickness: taskItem.metrics.totals.thickness readonly property int thickness: taskItem.metrics.totals.thickness
readonly property real applyOpacity: root.dropNewLauncher && !mouseHandler.onlyLaunchers readonly property real applyOpacity: root.dropNewLauncher && !mouseHandler.onlyLaunchers

@ -56,7 +56,7 @@ MouseArea{
return taskItem.metrics.totals.thickness + root.screenEdgeMargin; return taskItem.metrics.totals.thickness + root.screenEdgeMargin;
} else { } else {
if (root.dragSource || !root.parabolicEffectEnabled) { if (root.dragSource || !root.parabolicEffectEnabled) {
return LatteCore.Environment.separatorLength+2*root.lengthExtMargin; return LatteCore.Environment.separatorLength+2*taskItem.metrics.margin.length;
} }
} }
@ -83,7 +83,7 @@ MouseArea{
return taskItem.metrics.totals.thickness + root.screenEdgeMargin; return taskItem.metrics.totals.thickness + root.screenEdgeMargin;
} else { } else {
if (root.dragSource || !root.parabolicEffectEnabled) { if (root.dragSource || !root.parabolicEffectEnabled) {
return LatteCore.Environment.separatorLength+2*root.lengthExtMargin; return LatteCore.Environment.separatorLength+2*taskItem.metrics.margin.length;
} }
} }
@ -154,7 +154,7 @@ MouseArea{
property int pressX: -1 property int pressX: -1
property int pressY: -1 property int pressY: -1
property int resistanceDelay: 450 property int resistanceDelay: 450
property int spacersMaxSize: Math.max(0,Math.ceil(0.55*taskItem.metrics.iconSize) - root.lengthMargins) property int spacersMaxSize: Math.max(0,Math.ceil(0.55*taskItem.metrics.iconSize) - taskItem.metrics.totals.lengthEdges)
property int windowsCount: subWindows.windowsCount property int windowsCount: subWindows.windowsCount
property int windowsMinimizedCount: subWindows.windowsMinimized property int windowsMinimizedCount: subWindows.windowsMinimized
@ -350,8 +350,8 @@ MouseArea{
opacity: (separatorShadow.active) || forceHiddenState ? 0 : 0.4 opacity: (separatorShadow.active) || forceHiddenState ? 0 : 0.4
visible: taskItem.isSeparator visible: taskItem.isSeparator
width: root.vertical ? taskItem.metrics.iconSize : ((root.dragSource || root.editMode) ? LatteCore.Environment.separatorLength+root.lengthMargins: 1) width: root.vertical ? taskItem.metrics.iconSize : ((root.dragSource || root.editMode) ? LatteCore.Environment.separatorLength+taskItem.metrics.totals.lengthEdges: 1)
height: !root.vertical ? taskItem.metrics.iconSize : ((root.dragSource || root.editMode) ? LatteCore.Environment.separatorLength+root.lengthMargins: 1) height: !root.vertical ? taskItem.metrics.iconSize : ((root.dragSource || root.editMode) ? LatteCore.Environment.separatorLength+taskItem.metrics.totals.lengthEdges: 1)
property bool forceHiddenState: false property bool forceHiddenState: false

@ -74,7 +74,7 @@ SequentialAnimation {
((taskItem.hasNeighbourSeparator(lastValidIndex-1,false) && !taskItem.isSeparator && lastValidIndex>parabolicManager.firstRealTaskIndex) ((taskItem.hasNeighbourSeparator(lastValidIndex-1,false) && !taskItem.isSeparator && lastValidIndex>parabolicManager.firstRealTaskIndex)
|| (latteView && latteView.parabolicManager.isSeparator(latteView.latteAppletPos-1) && lastValidIndex<=parabolicManager.firstRealTaskIndex)); || (latteView && latteView.parabolicManager.isSeparator(latteView.latteAppletPos-1) && lastValidIndex<=parabolicManager.firstRealTaskIndex));
var spacer = nextTaskIsSeparator ? -(2+root.lengthMargin) : ( previousTaskIsSeparator ? (2+root.lengthMargin)/2 : 0); var spacer = nextTaskIsSeparator ? -(2+taskItem.metrics.totals.lengthEdge) : ( previousTaskIsSeparator ? (2+taskItem.metrics.totals.lengthEdge)/2 : 0);
//console.log("EDGES ::: " + parabolicManager.firstRealTaskIndex + " _ " + parabolicManager.lastRealTaskIndex); //console.log("EDGES ::: " + parabolicManager.firstRealTaskIndex + " _ " + parabolicManager.lastRealTaskIndex);
//console.log("Removing ::: " + lastValidIndex + " _ " + launcherUrl + " _ " + previousTaskIsSeparator + " _ " + nextTaskIsSeparator); //console.log("Removing ::: " + lastValidIndex + " _ " + launcherUrl + " _ " + previousTaskIsSeparator + " _ " + nextTaskIsSeparator);

@ -45,7 +45,7 @@ Loader {
return visualLockedWidth; return visualLockedWidth;
} }
return !root.vertical ? taskItem.wrapperAlias.width - 2*taskItem.wrapperAlias.mScale*root.lengthExtMargin : taskItem.wrapperAlias.width; return !root.vertical ? taskItem.wrapperAlias.width - 2*taskItem.wrapperAlias.mScale*taskItem.metrics.margin.length: taskItem.wrapperAlias.width;
} }
height: { height: {
@ -53,7 +53,7 @@ Loader {
return visualLockedHeight; return visualLockedHeight;
} }
return root.vertical ? taskItem.wrapperAlias.height - 2*taskItem.wrapperAlias.mScale*root.lengthExtMargin : taskItem.wrapperAlias.height; return root.vertical ? taskItem.wrapperAlias.height - 2*taskItem.wrapperAlias.mScale*taskItem.metrics.margin.length : taskItem.wrapperAlias.height;
} }
readonly property bool locked: inAttentionAnimation || inNewWindowAnimation || inBouncingAnimation readonly property bool locked: inAttentionAnimation || inNewWindowAnimation || inBouncingAnimation

@ -59,7 +59,7 @@ Flickable{
readonly property int scrollStep: metrics.iconSize * 1.5 readonly property int scrollStep: metrics.iconSize * 1.5
readonly property int currentPos: !root.vertical ? contentX : contentY readonly property int currentPos: !root.vertical ? contentX : contentY
readonly property int autoScrollTriggerLength: metrics.iconSize + root.lengthMargins/2 readonly property int autoScrollTriggerLength: metrics.iconSize + metrics.totals.lengthEdge
readonly property int alignment: { readonly property int alignment: {
if (root.location === PlasmaCore.Types.LeftEdge) { if (root.location === PlasmaCore.Types.LeftEdge) {

Loading…
Cancel
Save