From 6536fd80fc38327d540845437b4fd09bee28fb3b Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Fri, 17 Oct 2025 10:19:15 +0200 Subject: [PATCH] Fix #144359: Scrolled down Asset Shelf prevents drag & drop in viewport. The issue is in the `ED_region_overlap_isect_` family of functions I believe. Their purpose is to check if a coordinate is in the "non-transparent" or opaque parts of the overlapping region. These are getting event coordinates (in window space), converted to region relative space (substracting region->winrct). Comparison is in view space (through `UI_view2d_region_to_view_y`) to account for scrolling and zooming. The thing where it goes wrong is that we are actually comparing to `region->v2d.tot` (this can be huge, most of it not visible), where I think we should be comparing to `region->v2d.cur` (that is the part that is actually visible...) Swapping `region->v2d.tot` with `region->v2d.cur` is what this PR does. Pull Request: https://projects.blender.org/blender/blender/pulls/146032 --- source/blender/editors/screen/area_query.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/blender/editors/screen/area_query.cc b/source/blender/editors/screen/area_query.cc index 00f71d08449..8038471c177 100644 --- a/source/blender/editors/screen/area_query.cc +++ b/source/blender/editors/screen/area_query.cc @@ -24,7 +24,7 @@ bool ED_region_overlap_isect_x(const ARegion *region, const int event_x) if (region->v2d.mask.xmin == region->v2d.mask.xmax) { return false; } - return BLI_rctf_isect_x(®ion->v2d.tot, + return BLI_rctf_isect_x(®ion->v2d.cur, UI_view2d_region_to_view_x(®ion->v2d, event_x - region->winrct.xmin)); } @@ -35,7 +35,7 @@ bool ED_region_overlap_isect_y(const ARegion *region, const int event_y) if (region->v2d.mask.ymin == region->v2d.mask.ymax) { return false; } - return BLI_rctf_isect_y(®ion->v2d.tot, + return BLI_rctf_isect_y(®ion->v2d.cur, UI_view2d_region_to_view_y(®ion->v2d, event_y - region->winrct.ymin)); } @@ -98,8 +98,8 @@ bool ED_region_overlap_isect_x_with_margin(const ARegion *region, return false; } int region_x = event_x - region->winrct.xmin; - return ((region->v2d.tot.xmin <= UI_view2d_region_to_view_x(®ion->v2d, region_x + margin)) && - (region->v2d.tot.xmax >= UI_view2d_region_to_view_x(®ion->v2d, region_x - margin))); + return ((region->v2d.cur.xmin <= UI_view2d_region_to_view_x(®ion->v2d, region_x + margin)) && + (region->v2d.cur.xmax >= UI_view2d_region_to_view_x(®ion->v2d, region_x - margin))); } bool ED_region_overlap_isect_y_with_margin(const ARegion *region, @@ -112,8 +112,8 @@ bool ED_region_overlap_isect_y_with_margin(const ARegion *region, return false; } int region_y = event_y - region->winrct.ymin; - return ((region->v2d.tot.ymin <= UI_view2d_region_to_view_y(®ion->v2d, region_y + margin)) && - (region->v2d.tot.ymax >= UI_view2d_region_to_view_y(®ion->v2d, region_y - margin))); + return ((region->v2d.cur.ymin <= UI_view2d_region_to_view_y(®ion->v2d, region_y + margin)) && + (region->v2d.cur.ymax >= UI_view2d_region_to_view_y(®ion->v2d, region_y - margin))); } bool ED_region_overlap_isect_xy_with_margin(const ARegion *region,