UI: allow shrinking panel height to zero when open.
Currently if a panel becomes empty (draw simply returns), it stays at the last non-empty height. This seems to be caused by some legacy checks that may be completely obsolete, but the safest fix is to at least allow resetting height when the panel is open.
This commit is contained in:
parent
8f2538f4fb
commit
5397d8d268
|
@ -1630,7 +1630,7 @@ struct Panel *UI_panel_begin(struct ScrArea *sa,
|
|||
struct PanelType *pt,
|
||||
struct Panel *pa,
|
||||
bool *r_open);
|
||||
void UI_panel_end(uiBlock *block, int width, int height);
|
||||
void UI_panel_end(uiBlock *block, int width, int height, bool open);
|
||||
void UI_panels_scale(struct ARegion *ar, float new_width);
|
||||
void UI_panel_label_offset(struct uiBlock *block, int *r_x, int *r_y);
|
||||
int UI_panel_size_y(const struct Panel *pa);
|
||||
|
|
|
@ -367,7 +367,7 @@ Panel *UI_panel_begin(
|
|||
return pa;
|
||||
}
|
||||
|
||||
void UI_panel_end(uiBlock *block, int width, int height)
|
||||
void UI_panel_end(uiBlock *block, int width, int height, bool open)
|
||||
{
|
||||
Panel *pa = block->panel;
|
||||
|
||||
|
@ -390,21 +390,21 @@ void UI_panel_end(uiBlock *block, int width, int height)
|
|||
pa->sizey = height;
|
||||
}
|
||||
else {
|
||||
/* check if we need to do an animation */
|
||||
if (!ELEM(width, 0, pa->sizex) || !ELEM(height, 0, pa->sizey)) {
|
||||
pa->runtime_flag |= PNL_ANIM_ALIGN;
|
||||
if (height != 0) {
|
||||
pa->ofsy += pa->sizey - height;
|
||||
}
|
||||
}
|
||||
int old_sizex = pa->sizex, old_sizey = pa->sizey;
|
||||
|
||||
/* update width/height if non-zero */
|
||||
if (width != 0) {
|
||||
pa->sizex = width;
|
||||
}
|
||||
if (height != 0) {
|
||||
if (height != 0 || open) {
|
||||
pa->sizey = height;
|
||||
}
|
||||
|
||||
/* check if we need to do an animation */
|
||||
if (pa->sizex != old_sizex || pa->sizey != old_sizey) {
|
||||
pa->runtime_flag |= PNL_ANIM_ALIGN;
|
||||
pa->ofsy += old_sizey - pa->sizey;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2292,7 +2292,7 @@ static void ed_panel_draw(const bContext *C,
|
|||
}
|
||||
}
|
||||
|
||||
UI_panel_end(block, w, h);
|
||||
UI_panel_end(block, w, h, open);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue