diff --git a/source/blender/editors/interface/regions/interface_region_hud.cc b/source/blender/editors/interface/regions/interface_region_hud.cc index 2fcb113bb2c..226c5f0868d 100644 --- a/source/blender/editors/interface/regions/interface_region_hud.cc +++ b/source/blender/editors/interface/regions/interface_region_hud.cc @@ -253,14 +253,6 @@ static ARegion *hud_region_add(ScrArea *area) region->overlap = true; region->flag |= RGN_FLAG_DYNAMIC_SIZE; - if (region_win) { - float x, y; - - UI_view2d_scroller_size_get(®ion_win->v2d, true, &x, &y); - region->runtime.offset_x = x; - region->runtime.offset_y = y; - } - return region; } @@ -356,6 +348,16 @@ void ED_area_type_hud_ensure(bContext *C, ScrArea *area) ED_region_floating_init(region); ED_region_tag_redraw(region); + /* We need to update/initialize the runtime offsets. */ + ARegion *region_win = BKE_area_find_region_type(area, RGN_TYPE_WINDOW); + if (region_win) { + float x, y; + + UI_view2d_scroller_size_get(®ion_win->v2d, true, &x, &y); + region->runtime.offset_x = x; + region->runtime.offset_y = y; + } + /* Reset zoom level (not well supported). */ rctf reset_rect = {}; reset_rect.xmax = region->winx;