UI: move region toggle closer to the screen edge

Reduces 3d view navigation widget overlap.
This commit is contained in:
Campbell Barton
2018-08-16 12:43:30 +10:00
parent 4e41a44400
commit 9a72342c6e

View File

@@ -872,14 +872,17 @@ static void region_azone_edge(AZone *az, ARegion *ar)
BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
}
#define AZONEPAD_TAB_PLUSW (0.7f * U.widget_unit)
#define AZONEPAD_TAB_PLUSH (0.7f * U.widget_unit)
/* region already made zero sized, in shape of edge */
static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *ar)
{
AZone *azt;
int tot = 0, add;
/* Edge offset multiplied by the */
float edge_offset = 1.0f;
const float tab_size_x = 0.7f * U.widget_unit;
const float tab_size_y = 0.7f * U.widget_unit;
for (azt = sa->actionzones.first; azt; azt = azt->next) {
if (azt->edge == az->edge) tot++;
@@ -888,28 +891,28 @@ static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *ar)
switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
add = (ar->winrct.ymax == sa->totrct.ymin) ? 1 : 0;
az->x1 = ar->winrct.xmax - 2.5f * AZONEPAD_TAB_PLUSW;
az->x1 = ar->winrct.xmax - ((edge_offset + 1.0f) * tab_size_x);
az->y1 = ar->winrct.ymax - add;
az->x2 = ar->winrct.xmax - 1.5f * AZONEPAD_TAB_PLUSW;
az->y2 = ar->winrct.ymax - add + AZONEPAD_TAB_PLUSH;
az->x2 = ar->winrct.xmax - (edge_offset * tab_size_x);
az->y2 = ar->winrct.ymax - add + tab_size_y;
break;
case AE_BOTTOM_TO_TOPLEFT:
az->x1 = ar->winrct.xmax - 2.5f * AZONEPAD_TAB_PLUSW;
az->y1 = ar->winrct.ymin - AZONEPAD_TAB_PLUSH;
az->x2 = ar->winrct.xmax - 1.5f * AZONEPAD_TAB_PLUSW;
az->x1 = ar->winrct.xmax - ((edge_offset + 1.0f) * tab_size_x);
az->y1 = ar->winrct.ymin - tab_size_y;
az->x2 = ar->winrct.xmax - (edge_offset * tab_size_x);
az->y2 = ar->winrct.ymin;
break;
case AE_LEFT_TO_TOPRIGHT:
az->x1 = ar->winrct.xmin - AZONEPAD_TAB_PLUSH;
az->y1 = ar->winrct.ymax - 2.5f * AZONEPAD_TAB_PLUSW;
az->x1 = ar->winrct.xmin - tab_size_y;
az->y1 = ar->winrct.ymax - ((edge_offset + 1.0f) * tab_size_x);
az->x2 = ar->winrct.xmin;
az->y2 = ar->winrct.ymax - 1.5f * AZONEPAD_TAB_PLUSW;
az->y2 = ar->winrct.ymax - (edge_offset * tab_size_x);
break;
case AE_RIGHT_TO_TOPLEFT:
az->x1 = ar->winrct.xmax - 1;
az->y1 = ar->winrct.ymax - 2.5f * AZONEPAD_TAB_PLUSW;
az->x2 = ar->winrct.xmax - 1 + AZONEPAD_TAB_PLUSH;
az->y2 = ar->winrct.ymax - 1.5f * AZONEPAD_TAB_PLUSW;
az->y1 = ar->winrct.ymax - ((edge_offset + 1.0f) * tab_size_x);
az->x2 = ar->winrct.xmax - 1 + tab_size_y;
az->y2 = ar->winrct.ymax - (edge_offset * tab_size_x);
break;
}
/* rect needed for mouse pointer test */