mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-14 19:26:56 -04:00
M7: Auto Size measures vertically aligned area type from the top
auto_height lays the text out in a very tall probe frame; with Center, Bottom or Justify the lines moved down inside it and the frame grew to tens of thousands of points.
This commit is contained in:
1 parent
abdc26d8d1
commit
53e39884fc
1 file changed
+2
@@ -147,6 +147,8 @@ fn auto_height(t: &mut TextObject) -> bool {
|
||||
let col_w = if cols > 1 { ((b.width() - t.area.gutter.max(0.0) * (cols - 1) as f64) / cols as f64).max(1.0) } else { b.width() };
|
||||
with_size(&mut probe, col_w, tall);
|
||||
probe.area.columns = 1;
|
||||
// Measured from the top: aligned in the tall probe the lines would sit far below.
|
||||
probe.area.vertical_align = vectorcraft_doc::VerticalAlign::Top;
|
||||
let lay = vectorcraft_text::layout(db, &probe);
|
||||
let inset = t.area.inset.max(0.0);
|
||||
let Some(bottom) = lay.lines.iter().map(|l| l.baseline + l.descent).filter(|y| y.is_finite()).reduce(f64::max) else { return false };
|
||||
|
||||
Reference in new issue
Block a user