Fix T92371: Move AZONE_REGION When Overlapped

Overlapped regions have transparent backgrounds, so when placing
AZONE_REGION we need to move them in to the content edge.

See D12956 for details and examples.

Differential Revision: https://developer.blender.org/D12956

Reviewed by Hans Goudey
This commit is contained in:
Harley Acheson 2021-10-21 11:17:38 -07:00
parent 3858bf5c6f
commit 65490e6270
Notes: blender-bot 2023-02-14 08:38:11 +01:00
Referenced by issue #92371, N-panel resize area is offseted from where it should be.
1 changed files with 12 additions and 8 deletions

View File

@ -972,29 +972,33 @@ static void fullscreen_azone_init(ScrArea *area, ARegion *region)
#define AZONEPAD_ICON (0.45f * U.widget_unit)
static void region_azone_edge(AZone *az, ARegion *region)
{
/* If region is overlapped (transparent background), move AZone to content.
* Note this is an arbitrary amount that matches nicely with numbers elswhere. */
int overlap_padding = (region->overlap) ? (int)(0.4f * U.widget_unit) : 0;
switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
az->x1 = region->winrct.xmin;
az->y1 = region->winrct.ymax - AZONEPAD_EDGE;
az->y1 = region->winrct.ymax - AZONEPAD_EDGE - overlap_padding;
az->x2 = region->winrct.xmax;
az->y2 = region->winrct.ymax + AZONEPAD_EDGE;
az->y2 = region->winrct.ymax + AZONEPAD_EDGE - overlap_padding;
break;
case AE_BOTTOM_TO_TOPLEFT:
az->x1 = region->winrct.xmin;
az->y1 = region->winrct.ymin + AZONEPAD_EDGE;
az->y1 = region->winrct.ymin + AZONEPAD_EDGE + overlap_padding;
az->x2 = region->winrct.xmax;
az->y2 = region->winrct.ymin - AZONEPAD_EDGE;
az->y2 = region->winrct.ymin - AZONEPAD_EDGE + overlap_padding;
break;
case AE_LEFT_TO_TOPRIGHT:
az->x1 = region->winrct.xmin - AZONEPAD_EDGE;
az->x1 = region->winrct.xmin - AZONEPAD_EDGE + overlap_padding;
az->y1 = region->winrct.ymin;
az->x2 = region->winrct.xmin + AZONEPAD_EDGE;
az->x2 = region->winrct.xmin + AZONEPAD_EDGE + overlap_padding;
az->y2 = region->winrct.ymax;
break;
case AE_RIGHT_TO_TOPLEFT:
az->x1 = region->winrct.xmax + AZONEPAD_EDGE;
az->x1 = region->winrct.xmax + AZONEPAD_EDGE - overlap_padding;
az->y1 = region->winrct.ymin;
az->x2 = region->winrct.xmax - AZONEPAD_EDGE;
az->x2 = region->winrct.xmax - AZONEPAD_EDGE - overlap_padding;
az->y2 = region->winrct.ymax;
break;
}