1
0
Fork 0

Layout: only set fillxy/y if null

Fixes #820
master
Ben Whittaker 2021-09-23 22:21:32 -04:00
parent 16fe84704b
commit 807ac743fc
3 changed files with 13 additions and 4 deletions

View File

@ -329,14 +329,14 @@ Layout.prototype.update = function() {
l.c.forEach(updateMin);
l._h = l.c.reduce((a,b)=>Math.max(a,b._h+(b.pad<<1)),0);
l._w = l.c.reduce((a,b)=>a+b._w+(b.pad<<1),0);
if (l.c.some(c=>c.fillx)) l.fillx = 1;
if (l.c.some(c=>c.filly)) l.filly = 1;
if (l.fillx == null && l.c.some(c=>c.fillx)) l.fillx = 1;
if (l.filly == null && l.c.some(c=>c.filly)) l.filly = 1;
}, "v": function(l) {
l.c.forEach(updateMin);
l._h = l.c.reduce((a,b)=>a+b._h+(b.pad<<1),0);
l._w = l.c.reduce((a,b)=>Math.max(a,b._w+(b.pad<<1)),0);
if (l.c.some(c=>c.fillx)) l.fillx = 1;
if (l.c.some(c=>c.filly)) l.filly = 1;
if (l.fillx == null && l.c.some(c=>c.fillx)) l.fillx = 1;
if (l.filly == null && l.c.some(c=>c.filly)) l.filly = 1;
}
};
updateMin(l);

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,9 @@
g.clear();
var layout = new Layout({type:"h", filly: 0, c: [
{type: "txt", font: "50%", label: "A"},
{type:"v", c: [
{type: "txt", font: "10%", label: "B"},
{filly: 1},
{type: "txt", font: "10%", label: "C"},
]},
]});