stash
This commit is contained in:
parent
bbe52e4a78
commit
c3b43379a3
11 changed files with 362 additions and 56 deletions
|
|
@ -197,6 +197,18 @@ function relation(node, ownAxis, wantWidth, pxPerMm) {
|
|||
if (combinesAsWidth === wantWidth) {
|
||||
return {a, b};
|
||||
}
|
||||
if (a === 0) {
|
||||
// Every child is a fixed size (a === 0) in the combining direction - e.g. a row that's
|
||||
// just one crisp QR leaf, with no scale-free (text) sibling to invert against. Inverting
|
||||
// "width = b" for an a of 0 would divide by zero: a constant width genuinely doesn't
|
||||
// determine a height, since nothing here actually scales with it. Ask each child directly
|
||||
// for its own size in the wanted direction instead (every one of them must be similarly
|
||||
// fixed, since only a fixed leaf ever contributes a === 0), and take the largest - the
|
||||
// shared dimension has to fit whichever child needs the most room, with any child that
|
||||
// ends up with room to spare centered within it (see drawQrLeaf).
|
||||
const otherParts = node.map(child => relation(child, axis, wantWidth, pxPerMm));
|
||||
return {a: 0, b: Math.max(...otherParts.map(p => p.b))};
|
||||
}
|
||||
return {a: 1 / a, b: -b / a}; // invert: solve the affine relation the other way
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue