Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-05-16 09:32:02 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-05-16 09:32:02 +0300
commitb79fea28e391cc5b827ef720adcd499c938b5476 (patch)
treef9777853ed2918855fd56e417c366e5fdbaa7609 /source/blender/editors/screen
parent0a8d6bd8933759ad9f538bbf5d8fa2c39b8400f2 (diff)
Fix visible region overlap calculation
Existing code didn't account for top/bottom overlap.
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r--source/blender/editors/screen/area.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 8be89a6361e..24d6b7c6ecf 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -2604,14 +2604,29 @@ void ED_region_visible_rect(ARegion *ar, rcti *rect)
for (; arn; arn = arn->next) {
if (ar != arn && arn->overlap) {
if (BLI_rcti_isect(rect, &arn->winrct, NULL)) {
-
- /* overlap left, also check 1 pixel offset (2 regions on one side) */
- if (ABS(rect->xmin - arn->winrct.xmin) < 2)
- rect->xmin = arn->winrct.xmax;
+ if (ELEM(arn->alignment, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT)) {
+ /* Overlap left, also check 1 pixel offset (2 regions on one side). */
+ if (ABS(rect->xmin - arn->winrct.xmin) < 2) {
+ rect->xmin = arn->winrct.xmax;
+ }
- /* overlap right */
- if (ABS(rect->xmax - arn->winrct.xmax) < 2)
- rect->xmax = arn->winrct.xmin;
+ /* Overlap right. */
+ if (ABS(rect->xmax - arn->winrct.xmax) < 2) {
+ rect->xmax = arn->winrct.xmin;
+ }
+ }
+ else if (ELEM(arn->alignment, RGN_ALIGN_TOP, RGN_ALIGN_BOTTOM)) {
+ /* Same logic as above for vertical regions. */
+ if (ABS(rect->ymin - arn->winrct.ymin) < 2) {
+ rect->ymin = arn->winrct.ymax;
+ }
+ if (ABS(rect->ymax - arn->winrct.ymax) < 2) {
+ rect->ymax = arn->winrct.ymin;
+ }
+ }
+ else {
+ BLI_assert(!"Region overlap with unknown alignment");
+ }
}
}
}