simplify target_size

This commit is contained in:
Simon Gardling 2022-04-22 09:20:52 -04:00
parent ab9dadf924
commit 1d0848ebd2

View File

@ -116,20 +116,14 @@ impl FunctionEntry {
// target size of text edit box // target size of text edit box
let target_size = vec2(ui.available_width(), { let target_size = vec2(ui.available_width(), {
// need to get whether or not the text box has focus so it can be used to get the animated bool value
let had_focus = ui.ctx().memory().has_focus(te_id);
// get the animated bool that stores how "in focus" the text box is // get the animated bool that stores how "in focus" the text box is
let gotten_focus_value = ui.ctx().animate_bool(te_id, had_focus); let gotten_focus_value = {
let ctx = ui.ctx();
// multiplier for row_width let had_focus = ctx.memory().has_focus(te_id);
let multiplier = if gotten_focus_value == 1.0 { ctx.animate_bool(te_id, had_focus)
2.5
} else {
1.0 + (gotten_focus_value * 1.5)
}; };
row_height * multiplier row_height * (1.0 + (gotten_focus_value * 1.5))
}); });
let re = ui.add_sized( let re = ui.add_sized(