Fix LineEdit clear button for asymmetric stylebox

This commit is contained in:
Haoyu Qiu 2022-05-28 19:50:35 +08:00
parent 1f690f197a
commit e021fc9419

View file

@ -695,7 +695,7 @@ bool LineEdit::_is_over_clear_button(const Point2 &p_pos) const {
return false;
}
Ref<Texture2D> icon = Control::get_theme_icon(SNAME("clear"));
int x_ofs = get_theme_stylebox(SNAME("normal"))->get_offset().x;
int x_ofs = get_theme_stylebox(SNAME("normal"))->get_margin(SIDE_RIGHT);
return p_pos.x > get_size().width - icon->get_width() - x_ofs;
}