UI: remove empty space at the end of headers, tweak start/end spacing.
This commit is contained in:
@@ -906,7 +906,7 @@ void UI_exit(void);
|
|||||||
#define UI_ITEM_O_DEPRESS (1 << 9)
|
#define UI_ITEM_O_DEPRESS (1 << 9)
|
||||||
#define UI_ITEM_R_COMPACT (1 << 10)
|
#define UI_ITEM_R_COMPACT (1 << 10)
|
||||||
|
|
||||||
#define UI_HEADER_OFFSET_START ((void)0, 0.4f * UI_UNIT_X)
|
#define UI_HEADER_OFFSET ((void)0, 0.2f * UI_UNIT_X)
|
||||||
|
|
||||||
/* uiLayoutOperatorButs flags */
|
/* uiLayoutOperatorButs flags */
|
||||||
enum {
|
enum {
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ static void ui_update_flexible_spacing(const ARegion *region, uiBlock *block)
|
|||||||
|
|
||||||
rcti rect;
|
rcti rect;
|
||||||
ui_but_to_pixelrect(&rect, region, block, block->buttons.last);
|
ui_but_to_pixelrect(&rect, region, block, block->buttons.last);
|
||||||
const float buttons_width = (float)rect.xmax + UI_HEADER_OFFSET_START;
|
const float buttons_width = (float)rect.xmax + 2 * UI_HEADER_OFFSET;
|
||||||
const float region_width = (float)region->sizex * U.dpi_fac;
|
const float region_width = (float)region->sizex * U.dpi_fac;
|
||||||
|
|
||||||
if (region_width <= buttons_width) {
|
if (region_width <= buttons_width) {
|
||||||
|
|||||||
@@ -2193,13 +2193,12 @@ void ED_region_header_layout(const bContext *C, ARegion *ar)
|
|||||||
Header header = {NULL};
|
Header header = {NULL};
|
||||||
int maxco, xco, yco;
|
int maxco, xco, yco;
|
||||||
int headery = ED_area_headersize();
|
int headery = ED_area_headersize();
|
||||||
const int start_ofs = UI_HEADER_OFFSET_START;
|
|
||||||
bool region_layout_based = ar->flag & RGN_FLAG_DYNAMIC_SIZE;
|
bool region_layout_based = ar->flag & RGN_FLAG_DYNAMIC_SIZE;
|
||||||
|
|
||||||
/* set view2d view matrix for scrolling (without scrollers) */
|
/* set view2d view matrix for scrolling (without scrollers) */
|
||||||
UI_view2d_view_ortho(&ar->v2d);
|
UI_view2d_view_ortho(&ar->v2d);
|
||||||
|
|
||||||
xco = maxco = start_ofs;
|
xco = maxco = UI_HEADER_OFFSET;
|
||||||
yco = headery + (ar->winy - headery) / 2 - floor(0.2f * UI_UNIT_Y);
|
yco = headery + (ar->winy - headery) / 2 - floor(0.2f * UI_UNIT_Y);
|
||||||
|
|
||||||
/* XXX workaround for 1 px alignment issue. Not sure what causes it... Would prefer a proper fix - Julian */
|
/* XXX workaround for 1 px alignment issue. Not sure what causes it... Would prefer a proper fix - Julian */
|
||||||
@@ -2230,7 +2229,7 @@ void ED_region_header_layout(const bContext *C, ARegion *ar)
|
|||||||
if (xco > maxco)
|
if (xco > maxco)
|
||||||
maxco = xco;
|
maxco = xco;
|
||||||
|
|
||||||
int new_sizex = (maxco + start_ofs) / UI_DPI_FAC;
|
int new_sizex = (maxco + UI_HEADER_OFFSET) / UI_DPI_FAC;
|
||||||
|
|
||||||
if (region_layout_based && (ar->sizex != new_sizex)) {
|
if (region_layout_based && (ar->sizex != new_sizex)) {
|
||||||
/* region size is layout based and needs to be updated */
|
/* region size is layout based and needs to be updated */
|
||||||
@@ -2243,8 +2242,12 @@ void ED_region_header_layout(const bContext *C, ARegion *ar)
|
|||||||
UI_block_end(C, block);
|
UI_block_end(C, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!region_layout_based) {
|
||||||
|
maxco += UI_HEADER_OFFSET;
|
||||||
|
}
|
||||||
|
|
||||||
/* always as last */
|
/* always as last */
|
||||||
UI_view2d_totRect_set(&ar->v2d, maxco + (region_layout_based ? 0 : UI_UNIT_X + 80), headery);
|
UI_view2d_totRect_set(&ar->v2d, maxco, headery);
|
||||||
|
|
||||||
/* restore view matrix */
|
/* restore view matrix */
|
||||||
UI_view2d_view_restore(C);
|
UI_view2d_view_restore(C);
|
||||||
|
|||||||
Reference in New Issue
Block a user