mirror of
https://github.com/storytold/deckcraft.git
synced 2026-10-27 03:56:50 -06:00
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:
@@ -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()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user