Fix T87749 (partially): Text jitter in buttons and spreadsheet editor

This patch fixes jittering text when resizing regions of the UI as
described in T87749. The jitter was caused by the text padding
being stored as an integer which lead to inconsistent rounding.

Most notably this patch fixes the jitter in the new spreadsheet editor,
but not all occurrences of jitter described in T87749 (e.g. in UI lists)
are addressed.

Differential Revision: https://developer.blender.org/D11060
This commit is contained in:
Leon Leno 2021-04-23 09:55:58 -05:00 committed by Hans Goudey
parent 9afa738542
commit c463675188
Notes: blender-bot 2023-02-14 05:43:04 +01:00
Referenced by issue #87749, UI text jitters, when changing region size
1 changed files with 2 additions and 1 deletions

View File

@ -2420,7 +2420,8 @@ static void widget_draw_text_icon(const uiFontStyle *fstyle,
}
if (!no_text_padding) {
const int text_padding = (UI_TEXT_MARGIN_X * U.widget_unit) / but->block->aspect;
const int text_padding = round_fl_to_int((UI_TEXT_MARGIN_X * U.widget_unit) /
but->block->aspect);
if (but->editstr) {
rect->xmin += text_padding;
}