Fix T62524: Popover w/ keep-open moves on cursor motion
This commit is contained in:
@@ -193,14 +193,13 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, v
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Not attached to a button. */
|
/* Not attached to a button. */
|
||||||
int offset[2] = {0, 0};
|
int bounds_offset[2] = {0, 0};
|
||||||
UI_block_flag_enable(block, UI_BLOCK_LOOP);
|
UI_block_flag_enable(block, UI_BLOCK_LOOP);
|
||||||
UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
|
UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
|
||||||
UI_block_direction_set(block, block->direction);
|
UI_block_direction_set(block, block->direction);
|
||||||
block->minbounds = UI_MENU_WIDTH_MIN;
|
block->minbounds = UI_MENU_WIDTH_MIN;
|
||||||
bool use_place_under_active = !handle->refresh;
|
|
||||||
|
|
||||||
if (use_place_under_active) {
|
if (!handle->refresh) {
|
||||||
uiBut *but = NULL;
|
uiBut *but = NULL;
|
||||||
for (but = block->buttons.first; but; but = but->next) {
|
for (but = block->buttons.first; but; but = but->next) {
|
||||||
if (but->flag & (UI_SELECT | UI_SELECT_DRAW)) {
|
if (but->flag & (UI_SELECT | UI_SELECT_DRAW)) {
|
||||||
@@ -209,12 +208,16 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, v
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (but) {
|
if (but) {
|
||||||
offset[0] = -(but->rect.xmin + 0.8f * BLI_rctf_size_x(&but->rect));
|
bounds_offset[0] = -(but->rect.xmin + 0.8f * BLI_rctf_size_x(&but->rect));
|
||||||
offset[1] = -(but->rect.ymin + 0.5f * BLI_rctf_size_y(&but->rect));
|
bounds_offset[1] = -(but->rect.ymin + 0.5f * BLI_rctf_size_y(&but->rect));
|
||||||
}
|
}
|
||||||
|
copy_v2_v2_int(handle->prev_bounds_offset, bounds_offset);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
copy_v2_v2_int(bounds_offset, handle->prev_bounds_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
UI_block_bounds_set_popup(block, block_margin, offset);
|
UI_block_bounds_set_popup(block, block_margin, bounds_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
|
|||||||
Reference in New Issue
Block a user