mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 22:53:14 -04:00
Fix TextEdit's in RTL layouts (#5547)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
@@ -731,10 +731,32 @@ impl TextEdit<'_> {
|
||||
// Condition `!clip_text` is important to avoid breaking layout for `TextEdit::singleline` (PR #5640)
|
||||
let extra_size = galley.size() - rect.size();
|
||||
if extra_size.x > 0.0 || extra_size.y > 0.0 {
|
||||
ui.allocate_rect(
|
||||
Rect::from_min_size(outer_rect.max, extra_size),
|
||||
Sense::hover(),
|
||||
);
|
||||
match ui.layout().main_dir() {
|
||||
crate::Direction::LeftToRight | crate::Direction::TopDown => {
|
||||
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(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user