cursor finally working properly and removed from render_text

This commit is contained in:
2025-09-15 20:30:26 -04:00
parent 9d659b6afd
commit 2700c31c13
15 changed files with 110 additions and 118 deletions

View File

@@ -62,18 +62,18 @@ impl Widget for Text {
fn draw(&mut self, painter: &mut Painter) {
let font_system = &mut painter.text_data().font_system;
self.update_buf(font_system);
let (handle, offset) = painter.render_text(&mut self.buf, &self.attrs, &VisualCursor::None);
let (handle, offset) = painter.render_text(&mut self.buf, &self.attrs);
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;
painter.draw_texture_within(&handle, region);
painter.texture_within(&handle, region);
}
fn get_size(&mut self, ctx: &mut SizeCtx) -> Vec2 {
self.update_buf(&mut ctx.text.font_system);
let (handle, offset) = ctx.draw_text(&mut self.buf, &self.attrs, &VisualCursor::None);
let (handle, offset) = ctx.draw_text(&mut self.buf, &self.attrs);
offset.size(&handle)
}
}