decouple thickness margins from iconMargin

v0.6
Michail Vourlakos 8 years ago
parent b56cbc4084
commit ced4d67f55

@ -328,8 +328,11 @@ Item {
property int iconSize: root.iconSize property int iconSize: root.iconSize
property real scaledWidth: zoomScaleWidth * (layoutWidth + root.iconMargin) property int marginWidth: root.isVertical ? root.thickMargin : root.iconMargin
property real scaledHeight: zoomScaleHeight * (layoutHeight + root.iconMargin) property int marginHeight: root.isHorizontal ? root.thickMargin : root.iconMargin
property real scaledWidth: zoomScaleWidth * (layoutWidth + marginWidth)
property real scaledHeight: zoomScaleHeight * (layoutHeight + marginHeight)
property real zoomScaleWidth: disableScaleWidth ? 1 : zoomScale property real zoomScaleWidth: disableScaleWidth ? 1 : zoomScale
property real zoomScaleHeight: disableScaleHeight ? 1 : zoomScale property real zoomScaleHeight: disableScaleHeight ? 1 : zoomScale
@ -522,10 +525,10 @@ Item {
width: Math.round( container.isInternalViewSplitter ? wrapper.layoutWidth : parent.zoomScaleWidth * wrapper.layoutWidth ) width: Math.round( container.isInternalViewSplitter ? wrapper.layoutWidth : parent.zoomScaleWidth * wrapper.layoutWidth )
height: Math.round( container.isInternalViewSplitter ? wrapper.layoutHeight : parent.zoomScaleHeight * wrapper.layoutHeight ) height: Math.round( container.isInternalViewSplitter ? wrapper.layoutHeight : parent.zoomScaleHeight * wrapper.layoutHeight )
anchors.rightMargin: plasmoid.location === PlasmaCore.Types.RightEdge ? (root.iconMargin / 2) : 0 anchors.rightMargin: plasmoid.location === PlasmaCore.Types.RightEdge ? root.thickMarginBase : 0
anchors.leftMargin: plasmoid.location === PlasmaCore.Types.LeftEdge ? (root.iconMargin / 2) : 0 anchors.leftMargin: plasmoid.location === PlasmaCore.Types.LeftEdge ? root.thickMarginBase : 0
anchors.topMargin: plasmoid.location === PlasmaCore.Types.TopEdge ? (root.iconMargin / 2) : 0 anchors.topMargin: plasmoid.location === PlasmaCore.Types.TopEdge ? root.thickMarginBase : 0
anchors.bottomMargin: plasmoid.location === PlasmaCore.Types.BottomEdge ? (root.iconMargin / 2) : 0 anchors.bottomMargin: plasmoid.location === PlasmaCore.Types.BottomEdge ? root.thickMarginBase : 0
//BEGIN states //BEGIN states
states: [ states: [

@ -320,6 +320,30 @@ Window{
text: root.iconSize text: root.iconSize
} }
Text{
text: "Icon Margin"+space
}
Text{
text: root.iconMargin
}
Text{
text: "Thick Margin Base"+space
}
Text{
text: root.thickMarginBase
}
Text{
text: "Thick Margin High"+space
}
Text{
text: root.thickMarginHigh
}
Text{ Text{
text: " ----------- " text: " ----------- "
} }

@ -145,7 +145,7 @@ Item{
root.realPanelThickness = iconS; root.realPanelThickness = iconS;
return iconS; return iconS;
} else { } else {
var icons = root.statesLineSize + root.iconSize + root.iconMargin + 1; var icons = root.statesLineSize + root.iconSize + root.thickMargin + 1;
var panels = root.themePanelSize + root.panelMargin; var panels = root.themePanelSize + root.panelMargin;
root.realPanelThickness = icons; root.realPanelThickness = icons;

@ -47,20 +47,18 @@ Item{
property int slidingOutToPos: ((plasmoid.location===PlasmaCore.Types.LeftEdge)||(plasmoid.location===PlasmaCore.Types.TopEdge)) ? -thicknessNormal : thicknessNormal property int slidingOutToPos: ((plasmoid.location===PlasmaCore.Types.LeftEdge)||(plasmoid.location===PlasmaCore.Types.TopEdge)) ? -thicknessNormal : thicknessNormal
//it is used in order to not break the calculations for the thickness placement
//especially in automatic icon sizes calculations
property real iconMarginOriginal: 0.12*root.maxIconSize
property int statesLineSizeOriginal: root.latteApplet ? Math.ceil( root.maxIconSize/13 ) : 0 property int statesLineSizeOriginal: root.latteApplet ? Math.ceil( root.maxIconSize/13 ) : 0
property int thicknessAutoHidden: 2 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 thicknessMid: root.statesLineSize + (1 + (0.65 * (root.zoomFactor-1)))*(root.iconSize+root.thickMargin) //needed in some animations
property int thicknessNormal: Math.max(root.statesLineSize + root.iconSize + root.iconMargin + 1, root.realPanelSize + root.panelShadow) property int thicknessNormal: Math.max(root.statesLineSize + root.iconSize + root.thickMargin + 1, root.realPanelSize + root.panelShadow)
property int thicknessZoom: root.statesLineSize + ((root.iconSize+root.iconMargin) * root.zoomFactor) + 2 property int thicknessZoom: root.statesLineSize + ((root.iconSize+root.thickMargin) * root.zoomFactor) + 2
//it is used to keep thickness solid e.g. when iconSize changes from auto functions //it is used to keep thickness solid e.g. when iconSize changes from auto functions
property int thicknessMidOriginal: Math.max(thicknessNormalOriginal, statesLineSizeOriginal + (1 + (0.65 * (root.zoomFactor-1)))*(root.maxIconSize+iconMarginOriginal)) //needed in some animations property int thicknessMidOriginal: Math.max(thicknessNormalOriginal, statesLineSizeOriginal + (1 + (0.65 * (root.zoomFactor-1)))*(root.maxIconSize+root.thickMarginOriginal)) //needed in some animations
property int thicknessNormalOriginal: Math.max(thicknessNormalOriginalValue, root.realPanelSize + root.panelShadow) property int thicknessNormalOriginal: Math.max(thicknessNormalOriginalValue, root.realPanelSize + root.panelShadow)
property int thicknessNormalOriginalValue: statesLineSizeOriginal + root.maxIconSize + iconMarginOriginal + 1 property int thicknessNormalOriginalValue: statesLineSizeOriginal + root.maxIconSize + root.thickMarginOriginal + 1
property int thicknessZoomOriginal: Math.max(statesLineSizeOriginal + ((root.maxIconSize+iconMarginOriginal) * root.zoomFactor) + 2, property int thicknessZoomOriginal: Math.max(statesLineSizeOriginal + ((root.maxIconSize+root.thickMarginOriginal) * root.zoomFactor) + 2,
root.realPanelSize + root.panelShadow) root.realPanelSize + root.panelShadow)
Binding{ Binding{

@ -107,12 +107,22 @@ DragDrop.DropArea {
property int themePanelSize: { property int themePanelSize: {
//root.statesLineSize + root.iconSize + root.iconMargin + 1 //root.statesLineSize + root.iconSize + root.iconMargin + 1
var panelBase = root.statesLineSize + root.panelMargin; var panelBase = root.statesLineSize + root.panelMargin;
var iconMarginUsed = latteApplet ? root.iconMargin : 0; var margin = latteApplet ? thickMargin : 0;
var maxPanelSize = (root.statesLineSize + root.iconSize + iconMarginUsed + 1) - panelBase; var maxPanelSize = (root.statesLineSize + iconSize + margin + 1) - panelBase;
var percentage = plasmoid.configuration.panelSize/100; var percentage = plasmoid.configuration.panelSize/100;
return Math.max(panelBase, panelBase + percentage*maxPanelSize); return Math.max(panelBase, panelBase + percentage*maxPanelSize);
} }
//decouple iconMargin which now is used only for length calculations with thickMargins
//which are used for thickness calculations
property int thickMarginBase: Math.ceil(iconMargin/2)
property int thickMarginHigh: Math.ceil(iconMargin/2)
property int thickMargin: thickMarginBase + thickMarginHigh
//it is used in order to not break the calculations for the thickness placement
//especially in automatic icon sizes calculations
property int thickMarginOriginal: Math.ceil(0.12 * maxIconSize)
property int iconMargin: Math.ceil(0.12 * iconSize) property int iconMargin: Math.ceil(0.12 * iconSize)
property int statesLineSize: latteApplet ? Math.ceil( root.iconSize/13 ) : 0 property int statesLineSize: latteApplet ? Math.ceil( root.iconSize/13 ) : 0
@ -1160,7 +1170,7 @@ DragDrop.DropArea {
Item { Item {
id: dndSpacer id: dndSpacer
property int normalSize: root.statesLineSize + root.iconSize + root.iconMargin - 1 property int normalSize: root.statesLineSize + root.iconSize + root.thickMargin - 1
//visibilityManager.statesLineSizeOriginal + root.maxIconSize + visibilityManager.iconMarginOriginal - 1 //visibilityManager.statesLineSizeOriginal + root.maxIconSize + visibilityManager.iconMarginOriginal - 1
width: normalSize width: normalSize

@ -246,13 +246,17 @@ MouseArea{
property real scaleHeight: (inTempScaling == true) ? tempScaleHeight : mScale property real scaleHeight: (inTempScaling == true) ? tempScaleHeight : mScale
///Dont use Math.floor it adds one pixel in animations and creates glitches ///Dont use Math.floor it adds one pixel in animations and creates glitches
property real cleanScaling: root.realSize * mScale property int widthMargins: root.vertical ? root.thickMargin : root.iconMargin
property int heightMargins: !root.vertical ? root.thickMargin : root.iconMargin
property real basicScalingWidth : (inTempScaling == true) ? (root.realSize * scaleWidth) : cleanScaling property real cleanScalingWidth: (root.iconSize + widthMargins) * mScale
property real basicScalingHeight : (inTempScaling == true) ? (root.realSize * scaleHeight) : cleanScaling property real cleanScalingHeight: (root.iconSize + heightMargins) * mScale
property real regulatorWidth: basicScalingWidth-2; property real basicScalingWidth : (inTempScaling == true) ? ((root.iconSize + widthMargins) * scaleWidth) : cleanScalingWidth
property real regulatorHeight: basicScalingHeight-2; property real basicScalingHeight : (inTempScaling == true) ? ((root.iconSize + heightMargins) * scaleHeight) : cleanScalingHeight
property real regulatorWidth: basicScalingWidth;//-2;
property real regulatorHeight: basicScalingHeight;//-2;
/// end of Scalers/////// /// end of Scalers///////
//property int curIndex: icList.hoveredIndex //property int curIndex: icList.hoveredIndex

@ -123,26 +123,25 @@ Item{
anchors.rightMargin: root.position === PlasmaCore.Types.RightPositioned anchors.rightMargin: root.position === PlasmaCore.Types.RightPositioned
|| (root.position === PlasmaCore.Types.LeftPositioned || (root.position === PlasmaCore.Types.LeftPositioned
&& mainItemContainer.inAddRemoveAnimation) && mainItemContainer.inAddRemoveAnimation)
? margin : 0 ? root.thickMarginBase : 0
anchors.leftMargin: root.position === PlasmaCore.Types.LeftPositioned anchors.leftMargin: root.position === PlasmaCore.Types.LeftPositioned
|| (root.position === PlasmaCore.Types.RightPositioned || (root.position === PlasmaCore.Types.RightPositioned
&& mainItemContainer.inAddRemoveAnimation) && mainItemContainer.inAddRemoveAnimation)
? margin : 0 ? root.thickMarginBase : 0
anchors.topMargin: root.position === PlasmaCore.Types.TopPositioned anchors.topMargin: root.position === PlasmaCore.Types.TopPositioned
|| (root.position === PlasmaCore.Types.BottomPositioned || (root.position === PlasmaCore.Types.BottomPositioned
&& mainItemContainer.inAddRemoveAnimation) && mainItemContainer.inAddRemoveAnimation)
? margin : 0 ? root.thickMarginBase : 0
anchors.bottomMargin: root.position === PlasmaCore.Types.BottomPositioned anchors.bottomMargin: root.position === PlasmaCore.Types.BottomPositioned
|| (root.position === PlasmaCore.Types.TopPositioned || (root.position === PlasmaCore.Types.TopPositioned
&& mainItemContainer.inAddRemoveAnimation) && mainItemContainer.inAddRemoveAnimation)
? margin : 0 ? root.thickMarginBase : 0
width: Math.round(newTempSize) //+ 2*centralItem.shadowSize width: Math.round(newTempSize) //+ 2*centralItem.shadowSize
height: Math.round(width) height: Math.round(width)
//icon: decoration //icon: decoration
source: decoration source: decoration
property int margin: root.iconMargin/2
//visible: !root.enableShadows //visible: !root.enableShadows
onValidChanged: { onValidChanged: {

@ -112,6 +112,12 @@ Item {
property int durationTime: latteDock ? latteDock.durationTime : plasmoid.configuration.durationTime property int durationTime: latteDock ? latteDock.durationTime : plasmoid.configuration.durationTime
property int iconMargin: latteDock ? latteDock.iconMargin : 0.12*iconSize property int iconMargin: latteDock ? latteDock.iconMargin : 0.12*iconSize
property int iconSize: latteDock ? latteDock.iconSize : Math.max(plasmoid.configuration.iconSize, 16) property int iconSize: latteDock ? latteDock.iconSize : Math.max(plasmoid.configuration.iconSize, 16)
//decouple iconMargin which now is used only for length calculations with thickMargins
//which are used for thickness calculations
property int thickMarginBase: latteDock ? latteDock.thickMarginBase : Math.ceil(iconMargin/2)
property int thickMarginHigh: latteDock ? latteDock.thickMarginHigh : Math.ceil(iconMargin/2)
property int thickMargin: thickMarginBase + thickMarginHigh
property int statesLineSize: latteDock ? latteDock.statesLineSize : Math.ceil( root.iconSize/13 ) property int statesLineSize: latteDock ? latteDock.statesLineSize : Math.ceil( root.iconSize/13 )
property int tasksHeight: mouseHandler.height property int tasksHeight: mouseHandler.height
property int tasksWidth: mouseHandler.width property int tasksWidth: mouseHandler.width
@ -657,8 +663,8 @@ Item {
target: icList target: icList
property int maxSize: (root.hoveredIndex>=0 && !root.dragSource) ? property int maxSize: (root.hoveredIndex>=0 && !root.dragSource) ?
root.statesLineSize + root.zoomFactor * (root.iconSize + root.iconMargin) - 1 : root.statesLineSize + root.zoomFactor * (root.iconSize + root.thickMargin) - 1 :
root.statesLineSize + root.iconSize + root.iconMargin - 1 root.statesLineSize + root.iconSize + root.thickMargin - 1
onUrlsDropped: { onUrlsDropped: {
// If all dropped URLs point to application desktop files, we'll add a launcher for each of them. // If all dropped URLs point to application desktop files, we'll add a launcher for each of them.
@ -880,12 +886,12 @@ Item {
if(icList.previousCount !== icList.count){ if(icList.previousCount !== icList.count){
icList.previousCount = icList.count; icList.previousCount = icList.count;
var zoomedLength = Math.floor( 1.2 * (iconSize+iconMargin) * (root.zoomFactor)); var zoomedLength = Math.floor( 1.2 * (iconSize+thickMargin) * (root.zoomFactor));
var bigAxis = (tasksModel.count-1) * (iconSize+iconMargin) + zoomedLength; var bigAxis = (tasksModel.count-1) * (iconSize+thickMargin) + zoomedLength;
var smallAxis = zoomedLength + statesLineSize; var smallAxis = zoomedLength + statesLineSize;
var clearBigAxis = tasksModel.count * (iconSize+iconMargin) + (barLine.spacing/2); var clearBigAxis = tasksModel.count * (iconSize+thickMargin) + (barLine.spacing/2);
var clearSmallAxis = (iconSize+iconMargin)+statesLineSize; var clearSmallAxis = (iconSize+thickMargin)+statesLineSize;
// debugging code // debugging code
// ncounter++; // ncounter++;

Loading…
Cancel
Save