fix: text bounds calculation

This commit is contained in:
Ashley Wulber 2026-02-27 17:21:20 -05:00
parent 59fbf68c54
commit 4f80a7ad9e
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820

View file

@ -95,8 +95,23 @@ impl Text {
Text::Cached {
bounds,
clip_bounds,
align_y,
..
} => bounds.intersection(clip_bounds),
} => {
// XX Must account for alignment...
// Is this really how it should be handled though?
let mut bounds = *bounds;
match align_y {
alignment::Vertical::Center => {
bounds.y -= bounds.height / 2.;
}
alignment::Vertical::Bottom => {
bounds.y -= bounds.height;
}
_ => {}
};
bounds.intersection(clip_bounds)
}
Text::Raw { raw, .. } => Some(raw.clip_bounds),
}
}