UI: Fix Scrollbar overlaps sidebar on zoom #108295
|
@ -215,7 +215,12 @@ void ED_area_tag_refresh(ScrArea *area);
|
|||
* Only exported for WM.
|
||||
*/
|
||||
void ED_area_do_refresh(struct bContext *C, ScrArea *area);
|
||||
|
||||
struct AZone *ED_area_actionzone_find_by_type(const struct ScrArea *area,
|
||||
const struct ARegion *region,
|
||||
int azone_type);
|
||||
struct AZone *ED_area_azones_update(ScrArea *area, const int mouse_xy[2]);
|
||||
|
||||
/**
|
||||
* Show the given text in the area's header, instead of its regular contents.
|
||||
* Use NULL to disable this and show the regular header contents again.
|
||||
|
|
|
@ -3138,18 +3138,15 @@ void ED_region_panels_draw(const bContext *C, ARegion *region)
|
|||
UI_view2d_mask_from_win(v2d, &mask);
|
||||
const int category_tabs_width = round_fl_to_int(UI_view2d_scale_get_x(®ion->v2d) *
|
||||
UI_PANEL_CATEGORY_MARGIN_WIDTH);
|
||||
mask.xmax = mask.xmax - category_tabs_width;
|
||||
mask.xmax -= category_tabs_width;
|
||||
Harley marked this conversation as resolved
Outdated
|
||||
BLI_rcti_translate(®ion->v2d.vert, -category_tabs_width, 0);
|
||||
|
||||
/* Adjust the scroller's action zone. */
|
||||
LISTBASE_FOREACH (AZone *, az, &CTX_wm_area(C)->actionzones) {
|
||||
if (!(az->region == region && az->type == AZONE_REGION_SCROLL)) {
|
||||
continue;
|
||||
}
|
||||
az->x1 = region->v2d.vert.xmin + region->winrct.xmin - V2D_SCROLL_HIDE_WIDTH;
|
||||
az->x2 = region->v2d.vert.xmax + region->winrct.xmin + V2D_SCROLL_HIDE_WIDTH;
|
||||
AZone *az = ED_area_actionzone_find_by_type(CTX_wm_area(C), region, AZONE_REGION_SCROLL);
|
||||
Harley marked this conversation as resolved
Outdated
Campbell Barton
commented
It would read more clearly if there was a function to lookup the action zone, e.g.
It would read more clearly if there was a function to lookup the action zone, e.g.
```
AZone *az = BKE_area_find_action_zone_by_type(area, region, AZONE_REGION_SCROLL);
if (az) {
...
}
```
|
||||
if (az) {
|
||||
Harley marked this conversation as resolved
Outdated
Julian Eisel
commented
I don't like the idea of manipulating action-zones in region drawing code, this has quite a bit of a code smell to me. I don't like the idea of manipulating action-zones in region drawing code, this has quite a bit of a code smell to me. `region_azone_scrollbar_init()` sets the azone rectangles, could we do this elsewhere, based on the modified mask rectangle?
We could do it as part of `area_actionzone_refresh_xy()`, but that might not be called when we need it. Another option is to support dynamically changing rectangles, e.g. there could be a `AZone.get_rect()` callback instead of `Azone.rect`.
|
||||
az->x1 = region->winrct.xmin + region->v2d.vert.xmin - V2D_SCROLL_HIDE_WIDTH;
|
||||
az->x2 = region->winrct.xmin + region->v2d.vert.xmax + V2D_SCROLL_HIDE_WIDTH;
|
||||
BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool use_full_hide = false;
|
||||
|
|
|
@ -997,6 +997,16 @@ AZone *ED_area_actionzone_find_xy(ScrArea *area, const int xy[2])
|
|||
return area_actionzone_refresh_xy(area, xy, true);
|
||||
}
|
||||
|
||||
AZone *ED_area_actionzone_find_by_type(ScrArea *area, ARegion *region, int azone_type)
|
||||
{
|
||||
LISTBASE_FOREACH (AZone *, az, &area->actionzones) {
|
||||
if (az->region == region && az->type == azone_type) {
|
||||
return az;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AZone *ED_area_azones_update(ScrArea *area, const int xy[2])
|
||||
{
|
||||
return area_actionzone_refresh_xy(area, xy, false);
|
||||
|
|
Loading…
Reference in New Issue
Can still use
-=
.