wip center layout garbage
This commit is contained in:
parent
0a8713770b
commit
555d45f06c
@ -50,9 +50,7 @@ const CenterLayout = new Lang.Class({
|
|||||||
let [left, center, right] = container.get_children();
|
let [left, center, right] = container.get_children();
|
||||||
|
|
||||||
// Only support horizontal layouts for now.
|
// Only support horizontal layouts for now.
|
||||||
let [leftMinWidth, leftNaturalWidth] = left.get_preferred_width(availWidth);
|
|
||||||
let [centerMinWidth, centerNaturalWidth] = center.get_preferred_width(availWidth);
|
let [centerMinWidth, centerNaturalWidth] = center.get_preferred_width(availWidth);
|
||||||
let [rightMinWidth, rightNaturalWidth] = right.get_preferred_width(availWidth);
|
|
||||||
|
|
||||||
let sideWidth = (availWidth - centerNaturalWidth) / 2;
|
let sideWidth = (availWidth - centerNaturalWidth) / 2;
|
||||||
|
|
||||||
@ -60,30 +58,36 @@ const CenterLayout = new Lang.Class({
|
|||||||
childBox.y1 = box.y1;
|
childBox.y1 = box.y1;
|
||||||
childBox.y2 = box.y1 + availHeight;
|
childBox.y2 = box.y1 + availHeight;
|
||||||
|
|
||||||
let leftSide = Math.min(Math.floor(sideWidth), leftNaturalWidth);
|
if (left) {
|
||||||
if (rtl) {
|
let [leftMinWidth, leftNaturalWidth] = left.get_preferred_width(availWidth);
|
||||||
childBox.x1 = availWidth - leftSide;
|
let leftSide = Math.min(Math.floor(sideWidth), leftNaturalWidth);
|
||||||
childBox.x2 = availWidth;
|
if (rtl) {
|
||||||
} else {
|
childBox.x1 = availWidth - leftSide;
|
||||||
childBox.x1 = 0;
|
childBox.x2 = availWidth;
|
||||||
childBox.x2 = leftSide;
|
} else {
|
||||||
|
childBox.x1 = 0;
|
||||||
|
childBox.x2 = leftSide;
|
||||||
|
}
|
||||||
|
childBox.x1 += box.x1;
|
||||||
|
left.allocate(childBox, flags);
|
||||||
}
|
}
|
||||||
childBox.x1 += box.x1;
|
|
||||||
left.allocate(childBox, flags);
|
|
||||||
|
|
||||||
childBox.x1 = box.x1 + Math.ceil(sideWidth);
|
childBox.x1 = box.x1 + Math.ceil(sideWidth);
|
||||||
childBox.x2 = childBox.x1 + centerNaturalWidth;
|
childBox.x2 = childBox.x1 + centerNaturalWidth;
|
||||||
center.allocate(childBox, flags);
|
center.allocate(childBox, flags);
|
||||||
|
|
||||||
let rightSide = Math.min(Math.floor(sideWidth), rightNaturalWidth);
|
if (right) {
|
||||||
if (rtl) {
|
let [rightMinWidth, rightNaturalWidth] = right.get_preferred_width(availWidth);
|
||||||
childBox.x1 = 0;
|
let rightSide = Math.min(Math.floor(sideWidth), rightNaturalWidth);
|
||||||
childBox.x2 = rightSide;
|
if (rtl) {
|
||||||
} else {
|
childBox.x1 = 0;
|
||||||
childBox.x1 = availWidth - rightSide;
|
childBox.x2 = rightSide;
|
||||||
childBox.x2 = availWidth;
|
} else {
|
||||||
|
childBox.x1 = availWidth - rightSide;
|
||||||
|
childBox.x2 = availWidth;
|
||||||
|
}
|
||||||
|
childBox.x1 += box.x1;
|
||||||
|
right.allocate(childBox, flags);
|
||||||
}
|
}
|
||||||
childBox.x1 += box.x1;
|
|
||||||
right.allocate(childBox, flags);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user