Don't call scroll if TextEdit is fully in view (#1779)
* Don't call scroll if TextEdit is fully in view * Explain why the new logic was added * cargo fmt Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
parent
cb9bc8698d
commit
433719717a
1 changed files with 2 additions and 1 deletions
|
@ -610,7 +610,8 @@ impl<'t> TextEdit<'t> {
|
|||
&cursor_range.primary,
|
||||
);
|
||||
|
||||
if response.changed || selection_changed {
|
||||
let is_fully_visible = ui.clip_rect().contains_rect(rect); // TODO: remove this HACK workaround for https://github.com/emilk/egui/issues/1531
|
||||
if (response.changed || selection_changed) && !is_fully_visible {
|
||||
ui.scroll_to_rect(cursor_pos, None); // keep cursor in view
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue