UI: allow fractical unit size for layouts.

This commit is contained in:
2018-09-26 17:44:35 +02:00
parent b2a569dd68
commit cbe82f81e1
3 changed files with 18 additions and 18 deletions

View File

@@ -169,7 +169,7 @@ struct uiLayout {
bool variable_size; /* For layouts inside gridflow, they and their items shall never have a fixed maximal size. */
char alignment;
char emboss;
int units[2]; /* for fixed width or height to avoid UI size changes */
float units[2]; /* for fixed width or height to avoid UI size changes */
};
typedef struct uiLayoutItemFlow {
@@ -3857,12 +3857,12 @@ void uiLayoutSetScaleY(uiLayout *layout, float scale)
layout->scale[1] = scale;
}
void uiLayoutSetUnitsX(uiLayout *layout, int unit)
void uiLayoutSetUnitsX(uiLayout *layout, float unit)
{
layout->units[0] = unit;
}
void uiLayoutSetUnitsY(uiLayout *layout, int unit)
void uiLayoutSetUnitsY(uiLayout *layout, float unit)
{
layout->units[1] = unit;
}
@@ -3932,12 +3932,12 @@ float uiLayoutGetScaleY(uiLayout *layout)
return layout->scale[1];
}
int uiLayoutGetUnitsX(uiLayout *layout)
float uiLayoutGetUnitsX(uiLayout *layout)
{
return layout->units[0];
}
int uiLayoutGetUnitsY(uiLayout *layout)
float uiLayoutGetUnitsY(uiLayout *layout)
{
return layout->units[1];
}
@@ -4033,7 +4033,7 @@ static void ui_item_estimate(uiItem *item)
break;
}
/* force fixed size */
/* Force fixed size. */
if (litem->units[0] > 0) {
litem->w = UI_UNIT_X * litem->units[0];
}