Commit: 47ba487e05daf73018f7fd3af0a44d46228e9fd6 Author: Campbell Barton Date: Wed Mar 20 12:34:22 2019 +1100 Branches: master https://developer.blender.org/rB47ba487e05daf73018f7fd3af0a44d46228e9fd6
UI: center floating popovers Tweak placement so useful items are more likely to be nearby, centering horizontally and align vertically to the first button. =================================================================== M source/blender/editors/interface/interface_region_popover.c =================================================================== diff --git a/source/blender/editors/interface/interface_region_popover.c b/source/blender/editors/interface/interface_region_popover.c index 9fcf2a51652..d15eb7a3246 100644 --- a/source/blender/editors/interface/interface_region_popover.c +++ b/source/blender/editors/interface/interface_region_popover.c @@ -201,7 +201,11 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, v if (!handle->refresh) { uiBut *but = NULL; + uiBut *but_first = NULL; for (but = block->buttons.first; but; but = but->next) { + if ((but_first == NULL) && ui_but_is_editable(but)) { + but_first = but; + } if (but->flag & (UI_SELECT | UI_SELECT_DRAW)) { break; } @@ -209,7 +213,11 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, v if (but) { bounds_offset[0] = -(but->rect.xmin + 0.8f * BLI_rctf_size_x(&but->rect)); - bounds_offset[1] = -(but->rect.ymin + 0.5f * BLI_rctf_size_y(&but->rect)); + bounds_offset[1] = -BLI_rctf_cent_y(&but->rect); + } + else { + bounds_offset[0] = -(pup->ui_size_x / 2); + bounds_offset[1] = but_first ? -BLI_rctf_cent_y(&but_first->rect) : (UI_UNIT_Y / 2); } copy_v2_v2_int(handle->prev_bounds_offset, bounds_offset); } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs