1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-09 16:58:16 +03:00

fix #92,improve more three layouts for Fill

This commit is contained in:
Michail Vourlakos 2017-01-30 18:59:48 +02:00
parent 2152729ac0
commit ffe3391d21
3 changed files with 46 additions and 23 deletions

View File

@ -38,16 +38,16 @@ Item{
z:0
property int panelWidth: (root.panelAlignment === Latte.Dock.Justify) && root.isHorizontal && !root.editMode ?
layoutsContainer.width + 2*spacing : mainLayout.width + spacing
layoutsContainer.width + spacing : mainLayout.width + spacing
property int panelHeight: (root.panelAlignment === Latte.Dock.Justify) && root.isVertical && !root.editMode ?
layoutsContainer.height + 2*spacing : mainLayout.height + spacing
layoutsContainer.height + spacing : mainLayout.height + spacing
width: root.isHorizontal ? panelWidth : smallSize
height: root.isVertical ? panelHeight : smallSize
property int spacing: (root.panelAlignment === Latte.Dock.Center
|| plasmoid.configuration.panelPosition === Latte.Dock.Justify) ?
root.panelEdgeSpacing : root.panelEdgeSpacing/2
root.panelEdgeSpacing/2 : root.panelEdgeSpacing/2
property int smallSize: Math.max(3.7*root.statesLineSize, 16)
Behavior on opacity{

View File

@ -140,7 +140,7 @@ Item{
var tempThickness = root.isHorizontal ? height : width;
var space = root.useThemePanel ? (plasmoid.configuration.panelPosition === Latte.Dock.Justify) ?
2*root.panelEdgeSpacing + 2*root.shadowsSize : root.panelEdgeSpacing + 2*root.shadowsSize : 2;
root.panelEdgeSpacing + 2*root.shadowsSize : root.panelEdgeSpacing + 2*root.shadowsSize : 2;
if (normalState) {
//console.log("entered normal state...");

View File

@ -42,7 +42,7 @@ DragDrop.DropArea {
////
////BEGIN properties
property bool debugMode: true
property bool debugMode: false
property bool automaticSize: plasmoid.configuration.automaticIconSize
property bool confirmedDragEntered: false
@ -885,15 +885,16 @@ DragDrop.DropArea {
&& (iconSize===plasmoid.configuration.iconSize || iconSize === automaticIconSizeBasedSize) ) {
var layoutLength;
var maxLength = root.maxLength;
//console.log("------Entered check-----");
//console.log("max length: "+ maxLength);
if (root.isVertical) {
layoutLength = (plasmoid.configuration.panelPosition === Latte.Dock.Justify) ?
mainLayout.height+endLayout.height : mainLayout.height
startLayout.height+mainLayout.height+endLayout.height : mainLayout.height
} else {
layoutLength = (plasmoid.configuration.panelPosition === Latte.Dock.Justify) ?
mainLayout.width+endLayout.width : mainLayout.width
startLayout.height+mainLayout.width+endLayout.width : mainLayout.width
}
var toShrinkLimit = maxLength-(zoomFactor*(iconSize+2*iconMargin));
@ -1100,6 +1101,44 @@ DragDrop.DropArea {
height: (plasmoid.configuration.panelPosition === Latte.Dock.Justify) && root.isVertical && !root.editMode ?
root.maxLength : parent.height
property bool shouldCheckHalfs: (plasmoid.configuration.panelPosition === Latte.Dock.Justify) && (mainLayout.children>1)
property int contentsWidth: startLayout.width + mainLayout.width + endLayout.width
property int contentsHeight: startLayout.height + mainLayout.height + endLayout.height
onContentsWidthChanged: {
if (root.isHorizontal){
var firstHalfExited = false;
var secondHalfExited = false;
if (shouldCheckHalfs){
firstHalfExited = ( (startLayout.width + mainLayout.width/2) >= root.maxLength/2 );
secondHalfExited = ( (endLayout.width + mainLayout.width/2) >= root.maxLength/2 );
}
if (dock && ((contentsWidth >= root.maxLength) || firstHalfExited || secondHalfExited)) {
updateAutomaticIconSize();
}
}
}
onContentsHeightChanged: {
if (root.isVertical){
var firstHalfExited = false;
var secondHalfExited = false;
if (shouldCheckHalfs){
firstHalfExited = ( (startLayout.height + mainLayout.height/2) >= root.maxLength/2 );
secondHalfExited = ( (endLayout.height + mainLayout.height/2) >= root.maxLength/2 );
}
if (dock && ((contentsHeight >= root.maxLength) || firstHalfExited || secondHalfExited)) {
updateAutomaticIconSize();
}
}
}
Loader{
anchors.fill: parent
@ -1199,22 +1238,6 @@ DragDrop.DropArea {
property int beginIndex: 100
property int count: children.length
onWidthChanged: {
if (root.isHorizontal
&& ( (dock && (width+endLayout.width >= root.maxLength))
|| (root.editMode)) ){
updateAutomaticIconSize();
}
}
onHeightChanged: {
if (root.isVertical
&& ( (dock && (height+endLayout.height >= root.maxLength))
|| (root.editMode)) ){
updateAutomaticIconSize();
}
}
}
Grid{