Fix `TextEdit`'s in RTL layouts (#5547)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
parent
ea76b4eeca
commit
9db03983dd
|
|
@ -731,10 +731,32 @@ impl TextEdit<'_> {
|
||||||
// Condition `!clip_text` is important to avoid breaking layout for `TextEdit::singleline` (PR #5640)
|
// Condition `!clip_text` is important to avoid breaking layout for `TextEdit::singleline` (PR #5640)
|
||||||
let extra_size = galley.size() - rect.size();
|
let extra_size = galley.size() - rect.size();
|
||||||
if extra_size.x > 0.0 || extra_size.y > 0.0 {
|
if extra_size.x > 0.0 || extra_size.y > 0.0 {
|
||||||
ui.allocate_rect(
|
match ui.layout().main_dir() {
|
||||||
Rect::from_min_size(outer_rect.max, extra_size),
|
crate::Direction::LeftToRight | crate::Direction::TopDown => {
|
||||||
Sense::hover(),
|
ui.allocate_rect(
|
||||||
);
|
Rect::from_min_size(outer_rect.max, extra_size),
|
||||||
|
Sense::hover(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
crate::Direction::RightToLeft => {
|
||||||
|
ui.allocate_rect(
|
||||||
|
Rect::from_min_size(
|
||||||
|
emath::pos2(outer_rect.min.x - extra_size.x, outer_rect.max.y),
|
||||||
|
extra_size,
|
||||||
|
),
|
||||||
|
Sense::hover(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
crate::Direction::BottomUp => {
|
||||||
|
ui.allocate_rect(
|
||||||
|
Rect::from_min_size(
|
||||||
|
emath::pos2(outer_rect.min.x, outer_rect.max.y - extra_size.y),
|
||||||
|
extra_size,
|
||||||
|
),
|
||||||
|
Sense::hover(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue