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 committed by Michael Murphy
parent 78e331d5ed
commit 7d1b557112

View file

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