Commit f33d15e1 authored by Niccolò Venerandi's avatar Niccolò Venerandi
Browse files

Fix fitts law for small panels

parent daa4809b
......@@ -56,6 +56,9 @@ DragDrop.DropArea {
visible: false
imagePath: "widgets/panel-background"
}
//Margins are either the size of the margins in the SVG, unless that prevents the panel from being at least half a smallMedium icon + smallSpace) tall at which point we set the margin to whatever allows it to be that...or if it still won't fit, 1.
//the size a margin should be to force a panel to be the required size above
readonly property real spacingAtMinSize: Math.max(1, (currentLayout.isLayoutHorizontal ? root.height+panelSvg.fixedMargins.top*2 : root.width+panelSvg.fixedMargins.left*2) - units.iconSizes.smallMedium - units.smallSpacing*2)/2
//END properties
......@@ -279,10 +282,6 @@ function checkLastSpacer() {
}
}
//Margins are either the size of the margins in the SVG, unless that prevents the panel from being at least half a smallMedium icon + smallSpace) tall at which point we set the margin to whatever allows it to be that...or if it still won't fit, 1.
//the size a margin should be to force a panel to be the required size above
readonly property real spacingAtMinSize: Math.max(1, (currentLayout.isLayoutHorizontal ? root.height+panelSvg.fixedMargins.top*2 : root.width+panelSvg.fixedMargins.left*2) - units.iconSizes.smallMedium - units.smallSpacing*2)/2
readonly property bool fillArea: applet && (applet.constraintHints & PlasmaCore.Types.CanFillArea)
Layout.topMargin: (currentLayout.isLayoutHorizontal && !fillArea) ?Math.round(Math.min(spacingAtMinSize, panelSvg.fixedMargins.top)) : 0
......@@ -367,10 +366,10 @@ function checkLastSpacer() {
//BEGIN UI elements
anchors {
leftMargin: currentLayout.isLayoutHorizontal ? panelSvg.fixedMargins.left : 0
rightMargin: currentLayout.isLayoutHorizontal ? panelSvg.fixedMargins.right : 0
topMargin: currentLayout.isLayoutHorizontal ? 0 : panelSvg.fixedMargins.top
bottomMargin: currentLayout.isLayoutHorizontal ? 0 : panelSvg.fixedMargins.bottom
leftMargin: currentLayout.isLayoutHorizontal ? Math.min(spacingAtMinSize, panelSvg.fixedMargins.left) : 0
rightMargin: currentLayout.isLayoutHorizontal ? Math.min(spacingAtMinSize, panelSvg.fixedMargins.right) : 0
topMargin: currentLayout.isLayoutHorizontal ? 0 : Math.min(spacingAtMinSize, panelSvg.fixedMargins.top)
bottomMargin: currentLayout.isLayoutHorizontal ? 0 : Math.min(spacingAtMinSize, panelSvg.fixedMargins.bottom)
}
Item {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment