Fix T38602: Aligned layout breaks if panel too wide

This commit is contained in:
Campbell Barton 2014-02-27 19:00:35 +11:00
parent b9f14ea56b
commit 64eea27533
Notes: blender-bot 2023-02-14 20:10:52 +01:00
Referenced by issue blender/blender-addons#38602, Aligned layout breaks if panel too wide for icon-only enum + property without label text
1 changed files with 11 additions and 3 deletions

View File

@ -2671,9 +2671,17 @@ void uiBlockBeginAlign(uiBlock *block)
static bool buts_are_horiz(uiBut *but1, uiBut *but2)
{
float dx, dy;
dx = fabs(but1->rect.xmax - but2->rect.xmin);
dy = fabs(but1->rect.ymin - but2->rect.ymax);
/* simple case which can fail if buttons shift apart
* with proportional layouts, see: [#38602] */
if ((but1->rect.ymin == but2->rect.ymin) &&
(but1->rect.xmin != but2->rect.xmin))
{
return true;
}
dx = fabsf(but1->rect.xmax - but2->rect.xmin);
dy = fabsf(but1->rect.ymin - but2->rect.ymax);
return (dx <= dy);
}