SmartArt: keep pyramid text inside its band

Inset each pyramid band's text past the band's mid width so bullets no longer hang over the sloped sides; capped so the tip band still has room.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Nikita Rakitin
2026-10-14 01:47:15 +03:00
co-authored by Cursor
parent 1866de9895
commit f894bb1d17
+6
View File
@@ -563,6 +563,12 @@ fn layout_items(d: &Diagram, area: Xfrm) -> Vec<Item> {
sh.geom = Geom::Custom {
paths: vec![deckcraft_model::CustomPath { w, h: bh, d: path, fill: deckcraft_geom::preset::FillMode::Norm, stroke: true }],
};
// Keep the text inside the sloped sides: inset it to a bit past the band's mid width.
let inset = ((it + ib) / 2.0 + (it - ib).abs() / 4.0 + 4.0).min(w * 0.2);
if let Some(b) = &mut sh.text {
b.body.inset_l = Some(inset);
b.body.inset_r = Some(inset);
}
paint(d, &mut sh, i, false);
out.push((sh, g.clone()));
}