UI: Fix scrollbar highlighting outside of regions #105973

Merged
Harley Acheson merged 3 commits from guishe/blender:scrollbar-visibility-sidebar into main 2023-08-22 00:47:19 +02:00
1 changed files with 11 additions and 10 deletions

View File

@ -823,18 +823,19 @@ static bool azone_clipped_rect_calc(const AZone *az, rcti *r_rect_clip)
static void area_actionzone_get_rect(AZone *az, rcti *rect)
{
if (az->type == AZONE_REGION_SCROLL) {
const bool is_horizontal = az->direction == AZ_SCROLL_HOR;
const bool is_vertical = az->direction == AZ_SCROLL_VERT;
const bool is_right = is_vertical && bool(az->region->v2d.scroll & V2D_SCROLL_RIGHT);
const bool is_left = is_vertical && bool(az->region->v2d.scroll & V2D_SCROLL_LEFT);
const bool is_top = is_horizontal && bool(az->region->v2d.scroll & V2D_SCROLL_TOP);
const bool is_botton = is_horizontal && bool(az->region->v2d.scroll & V2D_SCROLL_BOTTOM);
/* For scroll azones use the area around the region's scroll-bar location. */
rcti scroller_vert = (az->direction == AZ_SCROLL_HOR) ? az->region->v2d.hor :
az->region->v2d.vert;
rcti scroller_vert = is_horizontal ? az->region->v2d.hor : az->region->v2d.vert;
BLI_rcti_translate(&scroller_vert, az->region->winrct.xmin, az->region->winrct.ymin);
rect->xmin = scroller_vert.xmin -
((az->direction == AZ_SCROLL_VERT) ? V2D_SCROLL_HIDE_HEIGHT : 0);
rect->ymin = scroller_vert.ymin -
((az->direction == AZ_SCROLL_HOR) ? V2D_SCROLL_HIDE_WIDTH : 0);
rect->xmax = scroller_vert.xmax +
((az->direction == AZ_SCROLL_VERT) ? V2D_SCROLL_HIDE_HEIGHT : 0);
rect->ymax = scroller_vert.ymax +
((az->direction == AZ_SCROLL_HOR) ? V2D_SCROLL_HIDE_WIDTH : 0);
rect->xmin = scroller_vert.xmin - (is_right ? V2D_SCROLL_HIDE_HEIGHT : 0);
rect->ymin = scroller_vert.ymin - (is_top ? V2D_SCROLL_HIDE_WIDTH : 0);
rect->xmax = scroller_vert.xmax + (is_left ? V2D_SCROLL_HIDE_HEIGHT : 0);
rect->ymax = scroller_vert.ymax + (is_botton ? V2D_SCROLL_HIDE_WIDTH : 0);
}
else {
azone_clipped_rect_calc(az, rect);