the great orientation refactor (move to x & y UiScalars/Spans) + don't call full size in align

This commit is contained in:
2025-11-20 15:44:39 -05:00
parent 96ef0c529b
commit 6251c23d37
20 changed files with 832 additions and 578 deletions

View File

@@ -100,11 +100,13 @@ impl Widget for Text {
}
}
pub fn text_region(tex: &TextTexture, align: Align) -> UiRegion {
pub fn text_region(tex: &TextTexture, align: RegionAlign) -> UiRegion {
let tex_dims = tex.handle.size();
let mut region = UiRegion::from_size_align(tex.size(), align);
region.top_left.abs += tex.top_left;
region.bot_right.abs = region.top_left.abs + tex_dims;
let mut region = tex.size().align(align);
region.x.start.abs += tex.top_left.x;
region.y.start.abs += tex.top_left.y;
region.x.end.abs = region.x.start.abs + tex_dims.x;
region.y.end.abs = region.y.start.abs + tex_dims.y;
region
}