diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-24 13:16:40 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-24 13:27:47 +0300 |
commit | bde1561fc1ad503f06b1873c767f615b6485a2e9 (patch) | |
tree | 83cb48b1334fa7333d811a211b533f169d7d1720 /source/blender | |
parent | cfe9c7b3bd533379b6a52380fd62d7cdfaefd183 (diff) |
Fix T63566: Pop-up closes before mouse-over
Closely spaced buttons caused the curve clipping popup to close
before the cursor could mouse-over it.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/interface/interface_region_popup.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/source/blender/editors/interface/interface_region_popup.c b/source/blender/editors/interface/interface_region_popup.c index 11b2e069d6c..c4bcd7074d8 100644 --- a/source/blender/editors/interface/interface_region_popup.c +++ b/source/blender/editors/interface/interface_region_popup.c @@ -236,10 +236,13 @@ static void ui_popup_block_position(wmWindow *window, } /* Compute offset based on direction. */ - int offset_x = 0, offset_y = 0; + float offset_x = 0, offset_y = 0; + + /* Ensure buttons don't come between the parent button and the popup, see: T63566. */ + const float offset_overlap = max_ff(U.pixelsize, 1.0f); if (dir1 == UI_DIR_LEFT) { - offset_x = butrct.xmin - block->rect.xmax; + offset_x = (butrct.xmin - block->rect.xmax) + offset_overlap; if (dir2 == UI_DIR_UP) { offset_y = butrct.ymin - block->rect.ymin - center_y - UI_MENU_PADDING; } @@ -248,7 +251,7 @@ static void ui_popup_block_position(wmWindow *window, } } else if (dir1 == UI_DIR_RIGHT) { - offset_x = butrct.xmax - block->rect.xmin; + offset_x = (butrct.xmax - block->rect.xmin) - offset_overlap; if (dir2 == UI_DIR_UP) { offset_y = butrct.ymin - block->rect.ymin - center_y - UI_MENU_PADDING; } @@ -257,7 +260,7 @@ static void ui_popup_block_position(wmWindow *window, } } else if (dir1 == UI_DIR_UP) { - offset_y = butrct.ymax - block->rect.ymin; + offset_y = (butrct.ymax - block->rect.ymin) - offset_overlap; if (dir2 == UI_DIR_RIGHT) { offset_x = butrct.xmax - block->rect.xmax + center_x; } @@ -271,7 +274,7 @@ static void ui_popup_block_position(wmWindow *window, } } else if (dir1 == UI_DIR_DOWN) { - offset_y = butrct.ymin - block->rect.ymax; + offset_y = (butrct.ymin - block->rect.ymax) + offset_overlap; if (dir2 == UI_DIR_RIGHT) { offset_x = butrct.xmax - block->rect.xmax + center_x; } |