[Bf-blender-cvs] [bde1561fc1a] master: Fix T63566: Pop-up closes before mouse-over
Campbell Barton
noreply at git.blender.org
Wed Apr 24 12:28:35 CEST 2019
Commit: bde1561fc1ad503f06b1873c767f615b6485a2e9
Author: Campbell Barton
Date: Wed Apr 24 20:16:40 2019 +1000
Branches: master
https://developer.blender.org/rBbde1561fc1ad503f06b1873c767f615b6485a2e9
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.
===================================================================
M source/blender/editors/interface/interface_region_popup.c
===================================================================
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;
}
More information about the Bf-blender-cvs
mailing list