UI: fix inconsistency in button rounding when zooming in.

Some widgets would have rounding relative to the button size, others
absolute. Now it's always absolute. Note changing Display Scale in the
user prefs is not zooming, the rounding still scales with that.
This commit is contained in:
2018-04-22 22:04:06 +02:00
parent 1da1288544
commit 1ba91ae2c0
2 changed files with 8 additions and 8 deletions

View File

@@ -2148,7 +2148,7 @@ static struct uiWidgetColors wcol_option = {
1,
15, -15,
0,
0.3333333f,
0.2f,
};
/* button that shows popup */
@@ -3162,7 +3162,7 @@ static void ui_draw_but_HSV_v(uiBut *but, const rcti *rect)
bTheme *btheme = UI_GetTheme();
uiWidgetColors *wcol = &btheme->tui.wcol_numslider;
uiWidgetBase wtb;
const float rad = wcol->roundness * BLI_rcti_size_x(rect);
const float rad = wcol->roundness * U.widget_unit;
float x, y;
float rgb[3], hsv[3], v;
bool color_profile = but->block->color_profile;
@@ -3250,7 +3250,7 @@ static void ui_draw_separator(const rcti *rect, uiWidgetColors *wcol)
static void widget_numbut_draw(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign, bool emboss)
{
uiWidgetBase wtb;
const float rad = wcol->roundness * BLI_rcti_size_y(rect);
const float rad = wcol->roundness * U.widget_unit;
const int handle_width = min_ii(BLI_rcti_size_x(rect) / 3, BLI_rcti_size_y(rect) * 0.7f);
if (state & UI_SELECT)
@@ -3510,7 +3510,7 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int
/* round corners */
float value = but->a1;
float offs = wcol->roundness * BLI_rcti_size_y(&rect_prog);
float offs = wcol->roundness * U.widget_unit;
float w = value * BLI_rcti_size_x(&rect_prog);
/* ensure minimium size */
@@ -3546,7 +3546,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
/* backdrop first */
offs = wcol->roundness * BLI_rcti_size_y(rect);
offs = wcol->roundness * U.widget_unit;
toffs = offs * 0.75f;
round_box_edges(&wtb, roundboxalign, rect, offs);
@@ -3712,7 +3712,7 @@ static void widget_icon_has_anim(uiBut *but, uiWidgetColors *wcol, rcti *rect, i
widget_init(&wtb);
wtb.draw_outline = false;
rad = wcol->roundness * BLI_rcti_size_y(rect);
rad = wcol->roundness * U.widget_unit;
round_box_edges(&wtb, UI_CNR_ALL, rect, rad);
widgetbase_draw(&wtb, wcol);
}
@@ -3885,7 +3885,7 @@ static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UN
recttemp.xmax -= delta;
recttemp.ymax -= delta;
rad = wcol->roundness * BLI_rcti_size_y(&recttemp);
rad = wcol->roundness * U.widget_unit;
round_box_edges(&wtb, UI_CNR_ALL, &recttemp, rad);
/* decoration */

View File

@@ -2966,7 +2966,7 @@ void init_userdef_do_versions(void)
btheme->tui.wcol_tool.roundness = 0.2f;
btheme->tui.wcol_text.roundness = 0.2f;
btheme->tui.wcol_radio.roundness = 0.2f;
btheme->tui.wcol_option.roundness = 0.333333f;
btheme->tui.wcol_option.roundness = 0.2f;
btheme->tui.wcol_toggle.roundness = 0.25f;
btheme->tui.wcol_num.roundness = 0.5f;
btheme->tui.wcol_numslider.roundness = 0.5f;