fixes for justify alignment arrangement

work/spdx
Michail Vourlakos 4 years ago
parent 2e7dcb5428
commit 2fd5f51e8d

@ -665,6 +665,7 @@ void ContainmentInterface::moveAppletsInJustifyAlignment(QQuickItem *start, QQui
if (issplitter) {
secondSplitterFound = true;
splitter2 = i;
appletlist[i]->setParentItem(end);
} else {
appletlist[i]->setParentItem(main);
}
@ -673,11 +674,13 @@ void ContainmentInterface::moveAppletsInJustifyAlignment(QQuickItem *start, QQui
}
}
if (splitter1>0) {
appletlist[splitter1]->stackAfter(appletlist[splitter1 - 1]);
}
if (splitter2>0 && splitter2<appletlist.count()-1) {
appletlist[splitter2]->stackBefore(appletlist[splitter2 + 1]);
for(int i=0; i<appletlist.count()-2; ++i) {
QQuickItem *before = appletlist[i];
QQuickItem *after = appletlist[i+1];
if (before->parentItem() == after->parentItem()) {
before->stackBefore(after);
}
}
}

@ -112,7 +112,7 @@ function restore() {
inRestore = false;
if (plasmoid.configuration.alignment === 10/*Justify*/) {
root.splitMainLayoutToLayouts();
root.moveAppletsBasedOnJustifyAlignment();
root.updateIndexes();
}
}

@ -219,7 +219,7 @@ DragDrop.DropArea {
dndSpacer.opacity = 0;
if (dragInfo.isPlasmoid && root.panelAlignment === LatteCore.Types.Justify) {
root.layoutManagerMoveAppletsBasedOnJustifyAlignment();
root.moveAppletsBasedOnJustifyAlignment();
}
}
}

@ -249,7 +249,7 @@ MouseArea {
// handle.width = currentApplet.width;
// handle.height = currentApplet.height;
root.layoutManagerSave();
root.layoutManagerMoveAppletsBasedOnJustifyAlignment();
root.moveAppletsBasedOnJustifyAlignment();
root.layouter.appletsInParentChange = false;
layouter.updateSizeForAppletsInFill();
}

@ -515,7 +515,7 @@ Item {
if (root.editMode){
if (panelAlignment===LatteCore.Types.Justify) {
addInternalViewSplittersInMainLayout();
splitMainLayoutToLayouts();
moveAppletsBasedOnJustifyAlignment();
} else {
joinLayoutsToMainLayout();
root.destroyInternalViewSplitters();
@ -975,10 +975,8 @@ Item {
}
}
function layoutManagerMoveAppletsBasedOnJustifyAlignment() {
if (plasmoid.configuration.alignment !== 10) {
return;
}
function moveAppletsBasedOnJustifyAlignment() {
layouter.appletsInParentChange = true;
if (latteView) {
latteView.extendedInterface.moveAppletsInJustifyAlignment(layoutsContainer.startLayout,
@ -989,50 +987,6 @@ Item {
layouter.appletsInParentChange = false;
}
function splitMainLayoutToLayouts() {
if (internalViewSplittersCount() === 2) {
layouter.appletsInParentChange = true;
console.log("LAYOUTS: Moving applets from MAIN to THREE Layouts mode...");
var splitter = -1;
var splitter2 = -1;
var totalChildren = layoutsContainer.mainLayout.children.length;
for (var i=0; i<totalChildren; ++i) {
var item = layoutsContainer.mainLayout.children[i];
if(item.isInternalViewSplitter && splitter === -1) {
splitter = i;
} else if (item.isInternalViewSplitter && splitter>=0 && splitter2 === -1) {
splitter2 = i;
}
}
// console.log("update layouts 1:"+splitter + " - "+splitter2);
if (splitter > 0) {
for (var i=0; i<=splitter; ++i){
var item = layoutsContainer.mainLayout.children[0];
item.parent = layoutsContainer.startLayout;
}
}
if (splitter2 > 0) {
splitter2 = splitter2 - splitter - 1;
// console.log("update layouts 2:"+splitter + " - "+splitter2);
totalChildren = layoutsContainer.mainLayout.children.length;
for (var i=totalChildren-1; i>=splitter2; --i){
var item = layoutsContainer.mainLayout.children[i];
LayoutManager.insertAtIndex(layoutsContainer.endLayout, item, 0);
}
}
layouter.appletsInParentChange = false;
}
}
function joinLayoutsToMainLayout() {
layouter.appletsInParentChange = true;

Loading…
Cancel
Save