UI: Asset Shelf (Experimental Feature) #104831
|
@ -931,16 +931,37 @@ static void fullscreen_azone_init(ScrArea *area, ARegion *region)
|
|||
BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the background color alpha is close to fully transparent. That is, a value of
|
||||
* less than 50 on a [0-255] scale (arbitrary/eyeballed threshold). Assumes the region uses
|
||||
* #TH_BACK for its background.
|
||||
*/
|
||||
static bool region_back_is_barely_visible(const ScrArea *area, const ARegion *region)
|
||||
{
|
||||
/* Ensure the right theme is active, may not be the case on startup, for example. */
|
||||
bThemeState theme_state;
|
||||
UI_Theme_Store(&theme_state);
|
||||
UI_SetTheme(area->spacetype, region->regiontype);
|
||||
|
||||
uchar back[4];
|
||||
UI_GetThemeColor4ubv(TH_BACK, back);
|
||||
|
||||
UI_Theme_Restore(&theme_state);
|
||||
|
||||
return back[3] < 50;
|
||||
}
|
||||
|
||||
#define AZONEPAD_EDGE (0.1f * U.widget_unit)
|
||||
#define AZONEPAD_ICON (0.45f * U.widget_unit)
|
||||
static void region_azone_edge(AZone *az, ARegion *region)
|
||||
static void region_azone_edge(const ScrArea *area, AZone *az, const ARegion *region)
|
||||
{
|
||||
/* If there is no visible region background, users typically expect the #AZone to be closer to
|
||||
* the content, so move it a bit. Headers-like regions are usually thin and there's not much
|
||||
* padding around them, so don't touch the #AZone there (also avoids mouse hover conflicts with
|
||||
* actual contents).
|
||||
* Note that this is an arbitrary amount that matches nicely with numbers elsewhere. */
|
||||
const int overlap_padding = (region->overlap && !RGN_TYPE_IS_HEADER_ANY(region->regiontype)) ?
|
||||
const int overlap_padding = (region->overlap && region_back_is_barely_visible(area, region) &&
|
||||
!RGN_TYPE_IS_HEADER_ANY(region->regiontype)) ?
|
||||
int(0.4f * U.widget_unit) :
|
||||
0;
|
||||
|
||||
|
@ -1059,7 +1080,7 @@ static void region_azone_edge_init(ScrArea *area,
|
|||
region_azone_tab_plus(area, az, region);
|
||||
}
|
||||
else {
|
||||
region_azone_edge(az, region);
|
||||
region_azone_edge(area, az, region);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue