fix(text_input): clip text in text_input if they exceed initial bounds

This commit is contained in:
Michael Aaron Murphy 2024-04-09 16:08:30 +02:00
parent 0caff62a18
commit a68e505fbc
No known key found for this signature in database
GPG key ID: B2732D4240C9212C

View file

@ -2136,6 +2136,7 @@ pub fn draw<'a, Message>(
} else { } else {
appearance.text_color appearance.text_color
}; };
renderer.fill_text( renderer.fill_text(
Text { Text {
content: if text.is_empty() { placeholder } else { &text }, content: if text.is_empty() { placeholder } else { &text },
@ -2153,13 +2154,9 @@ pub fn draw<'a, Message>(
); );
}; };
if text_width > text_bounds.width { renderer.with_layer(text_bounds, |renderer| {
renderer.with_layer(text_bounds, |renderer| { renderer.with_translation(Vector::new(-offset, 0.0), render);
renderer.with_translation(Vector::new(-offset, 0.0), render); });
});
} else {
render(renderer);
}
let trailing_icon_tree = children.get(child_index); let trailing_icon_tree = children.get(child_index);