sizing actually working correctly now

This commit is contained in:
2025-09-16 17:31:54 -04:00
parent b48acccb8d
commit f9097807a2
17 changed files with 333 additions and 194 deletions

View File

@@ -66,15 +66,15 @@ impl Widget for Text {
let dims = handle.size();
self.size = offset.size(&handle);
let mut region = self.region();
region.top_left.offset += offset.top_left;
region.bot_right.offset = region.top_left.offset + dims;
region.top_left.abs += offset.top_left;
region.bot_right.abs = region.top_left.abs + dims;
painter.texture_within(&handle, region);
}
fn get_size(&mut self, ctx: &mut SizeCtx) -> Vec2 {
fn desired_size(&mut self, ctx: &mut SizeCtx) -> UiVec2 {
self.update_buf(&mut ctx.text.font_system);
let (handle, offset) = ctx.draw_text(&mut self.buf, &self.attrs);
offset.size(&handle)
UiVec2::abs(offset.size(&handle))
}
}