diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h index 22f20eeb897..2ac8ce3e8a5 100644 --- a/source/blender/editors/include/UI_view2d.h +++ b/source/blender/editors/include/UI_view2d.h @@ -252,6 +252,9 @@ void UI_view2d_scrollers_calc(struct View2D *v2d, /** * Draw scroll-bars in the given 2D-region. */ +void UI_view2d_scrollers_draw_ex(struct View2D *v2d, + const struct rcti *mask_custom, + bool use_full_hide); void UI_view2d_scrollers_draw(struct View2D *v2d, const struct rcti *mask_custom); /* List view tools. */ diff --git a/source/blender/editors/interface/view2d.cc b/source/blender/editors/interface/view2d.cc index 5d97f99edee..bc94285a33d 100644 --- a/source/blender/editors/interface/view2d.cc +++ b/source/blender/editors/interface/view2d.cc @@ -1461,7 +1461,7 @@ void UI_view2d_scrollers_calc(View2D *v2d, } } -void UI_view2d_scrollers_draw(View2D *v2d, const rcti *mask_custom) +void UI_view2d_scrollers_draw_ex(View2D *v2d, const rcti *mask_custom, bool use_full_hide) { View2DScrollers scrollers; UI_view2d_scrollers_calc(v2d, mask_custom, &scrollers); @@ -1469,6 +1469,8 @@ void UI_view2d_scrollers_draw(View2D *v2d, const rcti *mask_custom) rcti vert, hor; const int scroll = view2d_scroll_mapped(v2d->scroll); const char emboss_alpha = btheme->tui.widget_emboss[3]; + const float alpha_min = use_full_hide ? 0.0f : V2D_SCROLL_MIN_ALPHA; + uchar scrollers_back_color[4]; /* Color for scrollbar backs */ @@ -1482,8 +1484,7 @@ void UI_view2d_scrollers_draw(View2D *v2d, const rcti *mask_custom) if (scroll & V2D_SCROLL_HORIZONTAL) { uiWidgetColors wcol = btheme->tui.wcol_scroll; /* 0..255 -> min...1 */ - const float alpha_fac = ((v2d->alpha_hor / 255.0f) * (1.0f - V2D_SCROLL_MIN_ALPHA)) + - V2D_SCROLL_MIN_ALPHA; + const float alpha_fac = ((v2d->alpha_hor / 255.0f) * (1.0f - alpha_min)) + alpha_min; rcti slider; int state; @@ -1519,8 +1520,7 @@ void UI_view2d_scrollers_draw(View2D *v2d, const rcti *mask_custom) uiWidgetColors wcol = btheme->tui.wcol_scroll; rcti slider; /* 0..255 -> min...1 */ - const float alpha_fac = ((v2d->alpha_vert / 255.0f) * (1.0f - V2D_SCROLL_MIN_ALPHA)) + - V2D_SCROLL_MIN_ALPHA; + const float alpha_fac = ((v2d->alpha_vert / 255.0f) * (1.0f - alpha_min)) + alpha_min; int state; slider.xmin = vert.xmin; @@ -1554,6 +1554,11 @@ void UI_view2d_scrollers_draw(View2D *v2d, const rcti *mask_custom) btheme->tui.widget_emboss[3] = emboss_alpha; } +void UI_view2d_scrollers_draw(View2D *v2d, const rcti *mask_custom) +{ + UI_view2d_scrollers_draw_ex(v2d, mask_custom, false); +} + /** \} */ /* -------------------------------------------------------------------- */ diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index b9b9821fd08..ed6caa73ecf 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -3124,7 +3124,11 @@ void ED_region_panels_draw(const bContext *C, ARegion *region) UI_view2d_mask_from_win(v2d, &mask); mask.xmax -= UI_PANEL_CATEGORY_MARGIN_WIDTH; } - UI_view2d_scrollers_draw(v2d, use_mask ? &mask : NULL); + bool use_full_hide = false; + if (region->overlap) { + use_full_hide = true; /* Don't always show scrollbars for transparent regions as it's distracting. */ + } + UI_view2d_scrollers_draw_ex(v2d, use_mask ? &mask : NULL, use_full_hide); } void ED_region_panels_ex(const bContext *C, ARegion *region, const char *contexts[])