Fix T63822: Sidebar tabs active area dead-zone
authorCampbell Barton <ideasman42@gmail.com>
Tue, 23 Apr 2019 20:57:36 +0000 (06:57 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 23 Apr 2019 20:57:36 +0000 (06:57 +1000)
Clip on one axis for aligned regions to avoid tabs being clipped out.

Introduced in recent fix for T61554

source/blender/editors/screen/area_query.c

index a4bcf62..4d33567 100644 (file)
@@ -112,8 +112,23 @@ bool ED_region_contains_xy(const ARegion *ar, const int event_xy[2])
       }
       else {
         /* Side-bar & any other kind of overlapping region. */
-        if (!ED_region_overlap_isect_xy_with_margin(ar, event_xy, overlap_margin)) {
-          return false;
+
+        /* Check alignment to avoid region tabs being clipped out
+         * by only clipping a single axis for aligned regions. */
+        if (ELEM(ar->alignment, RGN_ALIGN_TOP, RGN_ALIGN_BOTTOM)) {
+          if (!ED_region_overlap_isect_x_with_margin(ar, event_xy[0], overlap_margin)) {
+            return false;
+          }
+        }
+        else if (ELEM(ar->alignment, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT)) {
+          if (!ED_region_overlap_isect_y_with_margin(ar, event_xy[1], overlap_margin)) {
+            return false;
+          }
+        }
+        else {
+          if (!ED_region_overlap_isect_xy_with_margin(ar, event_xy, overlap_margin)) {
+            return false;
+          }
         }
       }
     }