Merge pull request #34314 from YeldhamDev/button_internal_margin_clip
Make Button and co. take internal margins into account when clipping text
This commit is contained in:
commit
ec97535ea3
1 changed files with 7 additions and 0 deletions
|
@ -190,6 +190,13 @@ void Button::_notification(int p_what) {
|
|||
|
||||
Point2 icon_ofs = !_icon.is_null() ? Point2(icon_region.size.width + get_constant("hseparation"), 0) : Point2();
|
||||
int text_clip = size.width - style->get_minimum_size().width - icon_ofs.width;
|
||||
if (_internal_margin[MARGIN_LEFT] > 0) {
|
||||
text_clip -= _internal_margin[MARGIN_LEFT] + get_constant("hseparation");
|
||||
}
|
||||
if (_internal_margin[MARGIN_RIGHT] > 0) {
|
||||
text_clip -= _internal_margin[MARGIN_RIGHT] + get_constant("hseparation");
|
||||
}
|
||||
|
||||
Point2 text_ofs = (size - style->get_minimum_size() - icon_ofs - font->get_string_size(xl_text) - Point2(_internal_margin[MARGIN_RIGHT] - _internal_margin[MARGIN_LEFT], 0)) / 2.0;
|
||||
|
||||
switch (align) {
|
||||
|
|
Loading…
Reference in a new issue