added column width options
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
#import "@preview/cetz:0.2.2": canvas, draw
|
||||
#import "utils.typ": get-participants-i, get-style
|
||||
#import "utils.typ": get-participants-i, get-style, normalize-units
|
||||
#import "group.typ"
|
||||
#import "participant.typ"
|
||||
#import participant: PAR-SPECIALS
|
||||
@ -194,6 +194,37 @@
|
||||
}
|
||||
widths.at(i) = w
|
||||
}
|
||||
|
||||
for elmt in elements {
|
||||
if elmt.type == "col" {
|
||||
let i1 = pars-i.at(elmt.p1)
|
||||
let i2 = pars-i.at(elmt.p2)
|
||||
if calc.abs(i1 - i2) != 1 {
|
||||
let i-min = calc.min(i1, i2)
|
||||
let i-max = calc.max(i1, i2)
|
||||
let others = pars-i.pairs()
|
||||
.sorted(key: p => p.last())
|
||||
.slice(i-min + 1, i-max)
|
||||
.map(p => "'" + p.first() + "'")
|
||||
.join(", ")
|
||||
panic(
|
||||
"Column participants must be consecutive (participants (" +
|
||||
others +
|
||||
") are in between)"
|
||||
)
|
||||
}
|
||||
let i = calc.min(i1, i2)
|
||||
|
||||
if elmt.width != auto {
|
||||
widths.at(i) = normalize-units(elmt.width)
|
||||
}
|
||||
widths.at(i) = calc.max(
|
||||
widths.at(i),
|
||||
normalize-units(elmt.min-width)
|
||||
) + normalize-units(elmt.margin)
|
||||
}
|
||||
}
|
||||
|
||||
return widths
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user