Fix drawing enum property with icon only flag
Enum properties with icon only flag should use minimum/fixed width in expanded layouts (alignment=UI_LAYOUT_ALIGN_EXPAND). Differential Revision: https://developer.blender.org/D2415 by @raa (only made some really minor corrections)
This commit is contained in:
parent
e2d7efc950
commit
524ab96245
|
@ -1235,8 +1235,15 @@ static void ui_item_rna_size(
|
|||
}
|
||||
}
|
||||
|
||||
if (!w)
|
||||
w = ui_text_icon_width(layout, name, icon, 0);
|
||||
if (!w) {
|
||||
if (type == PROP_ENUM && icon_only) {
|
||||
w = ui_text_icon_width(layout, "", ICON_BLANK1, 0);
|
||||
w += 0.6f * UI_UNIT_X;
|
||||
}
|
||||
else {
|
||||
w = ui_text_icon_width(layout, name, icon, 0);
|
||||
}
|
||||
}
|
||||
h = UI_UNIT_Y;
|
||||
|
||||
/* increase height for arrays */
|
||||
|
@ -1254,7 +1261,7 @@ static void ui_item_rna_size(
|
|||
else if (ui_layout_vary_direction(layout) == UI_ITEM_VARY_X) {
|
||||
if (type == PROP_BOOLEAN && name[0])
|
||||
w += UI_UNIT_X / 5;
|
||||
else if (type == PROP_ENUM)
|
||||
else if (type == PROP_ENUM && !icon_only)
|
||||
w += UI_UNIT_X / 4;
|
||||
else if (type == PROP_FLOAT || type == PROP_INT)
|
||||
w += UI_UNIT_X * 3;
|
||||
|
|
Loading…
Reference in New Issue