crop text images that are too big
This commit is contained in:
@@ -33,9 +33,7 @@ impl TextEdit {
|
||||
|
||||
impl Widget for TextEdit {
|
||||
fn draw(&mut self, painter: &mut Painter) {
|
||||
let tex = self.view.draw(&mut painter.size_ctx());
|
||||
let region = text_region(&tex, self.align);
|
||||
painter.texture_within(&tex.handle, region);
|
||||
let region = self.view.draw(painter);
|
||||
|
||||
if let Some(cursor) = &self.cursor
|
||||
&& let Some(offset) = cursor_pos(cursor, &self.buf)
|
||||
@@ -49,11 +47,11 @@ impl Widget for TextEdit {
|
||||
}
|
||||
|
||||
fn desired_width(&mut self, ctx: &mut SizeCtx) -> Len {
|
||||
Len::abs(self.view.draw(ctx).size.x)
|
||||
Len::abs(self.view.render(ctx).size.x)
|
||||
}
|
||||
|
||||
fn desired_height(&mut self, ctx: &mut SizeCtx) -> Len {
|
||||
Len::abs(self.view.draw(ctx).size.y)
|
||||
Len::abs(self.view.render(ctx).size.y)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user