From bde1561fc1ad503f06b1873c767f615b6485a2e9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 24 Apr 2019 20:16:40 +1000 Subject: 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. --- source/blender/editors/interface/interface_region_popup.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'source') 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; } -- cgit v1.2.3