Page MenuHome

UI: Fix text padding for labels without an icon
ClosedPublic

Authored by Yevgeny Makarov (jenkm) on Feb 24 2020, 8:57 PM.

Details

Summary

UI: Fix text padding for labels without an icon.

In the screenshots below, first old then new.

Diff Detail

Repository
rB Blender

Event Timeline

Yevgeny Makarov (jenkm) edited the summary of this revision. (Show Details)
Yevgeny Makarov (jenkm) edited the summary of this revision. (Show Details)Feb 25 2020, 7:10 PM
Yevgeny Makarov (jenkm) retitled this revision from [WIP] Fix text padding for labels without icon to UI: Fix text padding for labels without an icon.
Yevgeny Makarov (jenkm) edited the summary of this revision. (Show Details)

Makes sense, and looks good in all the places I could find. I am a little worried that there might be cases where this breaks layouts or causes unexpected issues, but couldn't immediately ses any issues.

This revision is now accepted and ready to land.Mar 1 2020, 9:07 PM

I'd love to have this alignment issue fixed, but I remain a bit leery and suspicious about the text_padding being divided by two. Do we know where the extra comes from? I'd feel better if we were subtracting a value related to some other value, or even a constant scaled by widget_unit. Or if it is doubled somewhere (and therefore makes sense to half it here) then I'd like to see a comment explaining that.

However, if this fixes it yet the exact reason is (so far) unknown - I know how hard these things are to track down - then I'd still like a comment explaining such and maybe with a "TODO" comment as well.

@Harley Acheson (harley) If you set text_padding to zero, you can easily see what this padding does. It is located in the widget_draw_text_icon function.

This padding already depends on U.widget_unit, so just dividing by two should work well.
There may be a different value here, zero for example, but I think the half looks good, and it is safer because there is still some indent.

Found the related patch: D4503.