Refactor: Simplify Block Re-centering
PR #129125 allowed the movement of centered dialogs, like About and Splash, without them snapping back to their original positions. But that change was more complex than necessary. This returns interface_region_popup.cc to exactly as it was before any of this, and interface.cc gets simpler too. In a nutshell recentering these dialogs is a lot easier that seemed at first. Pull Request: https://projects.blender.org/blender/blender/pulls/131464
This commit is contained in:
committed by
Harley Acheson
parent
9b9da3e5af
commit
7c3db55b29
@@ -491,8 +491,9 @@ static void ui_block_bounds_calc_centered(wmWindow *window, uiBlock *block)
|
||||
ui_block_bounds_calc(block);
|
||||
}
|
||||
|
||||
static void ui_block_bounds_calc_post_centered(uiBlock *block, const blender::int2 &xy)
|
||||
static void ui_block_bounds_calc_post_centered(uiBlock *block)
|
||||
{
|
||||
const blender::int2 xy(block->handle->region->winrct.xmin, block->handle->region->winrct.ymin);
|
||||
const int margin = int(12.0f * UI_SCALE_FAC);
|
||||
ui_block_bounds_calc(block);
|
||||
UI_block_translate(block, xy[0] - block->rect.xmin + margin, xy[1] - block->rect.ymin + margin);
|
||||
@@ -2009,7 +2010,7 @@ void UI_block_end_ex(const bContext *C,
|
||||
ui_block_bounds_calc_centered(window, block);
|
||||
}
|
||||
else {
|
||||
ui_block_bounds_calc_post_centered(block, xy);
|
||||
ui_block_bounds_calc_post_centered(block);
|
||||
}
|
||||
break;
|
||||
case UI_BLOCK_BOUNDS_PIE_CENTER:
|
||||
|
||||
@@ -706,11 +706,6 @@ uiBlock *ui_popup_block_refresh(bContext *C,
|
||||
block->oldblock = nullptr;
|
||||
|
||||
if (!block->endblock) {
|
||||
/* Use previous position if it has been moved. */
|
||||
const bool moved = handle->refresh &&
|
||||
!(handle->grab_xy_prev[0] == 0 && handle->grab_xy_prev[1] == 0);
|
||||
const blender::int2 xy(moved ? region->winrct.xmin : handle->popup_create_vars.event_xy[0],
|
||||
moved ? region->winrct.ymin : handle->popup_create_vars.event_xy[1]);
|
||||
UI_block_end_ex(C,
|
||||
CTX_data_main(C),
|
||||
window,
|
||||
@@ -718,7 +713,7 @@ uiBlock *ui_popup_block_refresh(bContext *C,
|
||||
region,
|
||||
CTX_data_depsgraph_pointer(C),
|
||||
block,
|
||||
xy,
|
||||
handle->popup_create_vars.event_xy,
|
||||
handle->popup_create_vars.event_xy);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user