1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-24 18:03:53 +03:00

enable automatic sizes in edit mode

--block also the editing background to
change size
This commit is contained in:
Michail Vourlakos 2018-02-11 17:20:06 +02:00
parent 432241dd93
commit f5f254c0db
3 changed files with 26 additions and 19 deletions

View File

@ -140,12 +140,12 @@ Item{
onLocationChanged: initializeEditPosition();
}
Connections{
/* Connections{
target: root
onIconSizeChanged: initializeEditPosition();
onPanelAlignmentChanged: initializeEditPosition();
onOffsetChanged: initializeEditPosition();
}
}*/
onRootThicknessChanged: {
initializeEditPosition();
@ -171,17 +171,17 @@ Item{
onYChanged: updateEffectsArea();
onWidthChanged: {
if (root.isHorizontal) {
/*if (root.isHorizontal) {
initializeEditPosition();
}
}*/
updateEffectsArea();
}
onHeightChanged: {
if (root.isVertical) {
/* if (root.isVertical) {
initializeEditPosition();
}
}*/
updateEffectsArea();
}
@ -204,15 +204,19 @@ Item{
function initializeNormalPosition() {
if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
y = rootThickness;
x = 0;
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
x = rootThickness;
y = 0;
} else if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
x = -editVisual.thickness;
y = 0;
} else if (plasmoid.location === PlasmaCore.Types.TopEdge) {
y = -editVisual.thickness;
x = 0;
}
if (root.isHorizontal) {
/* if (root.isHorizontal) {
if (plasmoid.configuration.panelPosition === Latte.Dock.Justify) {
x = root.width/2 - editVisual.editLength/2 + root.offset;
} else if (root.panelAlignment === Latte.Dock.Left) {
@ -232,22 +236,26 @@ Item{
} else if (root.panelAlignment === Latte.Dock.Bottom) {
y = root.height - editVisual.editLength - root.offset;
}
}
}*/
}
function initializeEditPosition() {
if (root.editMode) {
if (plasmoid.location === PlasmaCore.Types.LeftEdge){
x = 0;
y = 0;
} else if (plasmoid.location === PlasmaCore.Types.TopEdge) {
x = 0;
y = 0;
} else if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
x = 0;
y = rootThickness - thickness;
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
x = rootThickness - thickness;
y = 0;
}
if (root.isHorizontal) {
/* if (root.isHorizontal) {
if (plasmoid.configuration.panelPosition === Latte.Dock.Justify) {
x = root.width/2 - editVisual.width/2 + root.offset;
} else if (root.panelAlignment === Latte.Dock.Left) {
@ -267,7 +275,7 @@ Item{
} else if (root.panelAlignment === Latte.Dock.Bottom) {
y = root.height - editVisual.height - root.offset;
}
}
}*/
}
}

View File

@ -353,13 +353,6 @@ Item{
onSizeWithNoFillAppletsChanged: HeuristicTools.updateSizeForAppletsInFill();
transitions: Transition {
NumberAnimation {
duration: root.animationTime
easing.type: Easing.OutQuad
}
}
//////////////////////////BEGIN states
//user set Panel Positions
// 0-Center, 1-Left, 2-Right, 3-Top, 4-Bottom

View File

@ -407,6 +407,7 @@ DragDrop.DropArea {
onEditModeChanged: {
if (editMode) {
visibilityManager.updateMaskArea();
updateAutomaticIconSize();
} else {
updateAutomaticIconSize();
layoutsContainer.updateSizeForAppletsInFill();
@ -541,7 +542,12 @@ DragDrop.DropArea {
//dndSpacer.parent = root;
}
onMaxLengthChanged: layoutsContainer.updateSizeForAppletsInFill();
onMaxLengthChanged: {
layoutsContainer.updateSizeForAppletsInFill();
if (root.editMode) {
updateAutomaticIconSize();
}
}
onToolBoxChanged: {
if (toolBox) {
@ -1107,7 +1113,7 @@ DragDrop.DropArea {
function updateAutomaticIconSize() {
if ( !blockAutomaticUpdateIconSize.running
&& (visibilityManager.normalState && !root.editMode && !visibilityManager.inTempHiding
&& ((visibilityManager.normalState || root.editMode) && !visibilityManager.inTempHiding
&& (root.autoDecreaseIconSize || (!root.autoDecreaseIconSize && root.iconSize!=root.maxIconSize)))
&& (iconSize===root.maxIconSize || iconSize === automaticIconSizeBasedSize) ) {
blockAutomaticUpdateIconSize.start();