Fix ugly drawing of closed panels in horizontal layout
Also minor cleanup
This commit is contained in:
parent
f5a471ef86
commit
3100fbef5e
|
@ -569,6 +569,8 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
|
|||
rcti headrect;
|
||||
rctf itemrect;
|
||||
int ofsx;
|
||||
const bool is_closed_x = (panel->flag & PNL_CLOSEDX) ? true : false;
|
||||
const bool is_closed_y = (panel->flag & PNL_CLOSEDY) ? true : false;
|
||||
|
||||
if (panel->paneltab) return;
|
||||
if (panel->type && (panel->type->flag & PNL_NO_HEADER)) return;
|
||||
|
@ -581,7 +583,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
|
|||
|
||||
{
|
||||
float minx = rect->xmin;
|
||||
float maxx = rect->xmax;
|
||||
float maxx = is_closed_x ? (minx + PNL_HEADER / block->aspect) : rect->xmax;
|
||||
float y = headrect.ymax;
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
|
@ -596,8 +598,11 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
|
|||
}
|
||||
else if (!(panel->runtime_flag & PNL_FIRST)) {
|
||||
/* draw embossed separator */
|
||||
minx += 5.0f / block->aspect;
|
||||
maxx -= 5.0f / block->aspect;
|
||||
|
||||
if (is_closed_x == false) {
|
||||
minx += 5.0f / block->aspect;
|
||||
maxx -= 5.0f / block->aspect;
|
||||
}
|
||||
|
||||
glColor4f(0.0f, 0.0f, 0.0f, 0.5f);
|
||||
fdrawline(minx, y, maxx, y);
|
||||
|
@ -624,7 +629,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
|
|||
}
|
||||
|
||||
/* horizontal title */
|
||||
if (!(panel->flag & PNL_CLOSEDX)) {
|
||||
if (is_closed_x == false) {
|
||||
ui_draw_aligned_panel_header(style, block, &headrect, 'h');
|
||||
|
||||
/* itemrect smaller */
|
||||
|
@ -640,9 +645,10 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
|
|||
/* if the panel is minimized vertically:
|
||||
* (------)
|
||||
*/
|
||||
if (panel->flag & PNL_CLOSEDY) {
|
||||
if (is_closed_y) {
|
||||
/* skip */
|
||||
}
|
||||
else if (panel->flag & PNL_CLOSEDX) {
|
||||
else if (is_closed_x) {
|
||||
/* draw vertical title */
|
||||
ui_draw_aligned_panel_header(style, block, &headrect, 'v');
|
||||
}
|
||||
|
@ -689,9 +695,9 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
|
|||
|
||||
BLI_rctf_scale(&itemrect, 0.35f);
|
||||
|
||||
if (panel->flag & PNL_CLOSEDY)
|
||||
if (is_closed_y)
|
||||
ui_draw_tria_rect(&itemrect, 'h');
|
||||
else if (panel->flag & PNL_CLOSEDX)
|
||||
else if (is_closed_x)
|
||||
ui_draw_tria_rect(&itemrect, 'h');
|
||||
else
|
||||
ui_draw_tria_rect(&itemrect, 'v');
|
||||
|
|
Loading…
Reference in New Issue