Fix: The position of the redo panel was inconsistent

If the redo panel wasn't initalized from scratch, it would not get the
scrollbar offset. Now always apply this runtime offset.

Pull Request: https://projects.blender.org/blender/blender/pulls/125092
This commit is contained in:
Sebastian Parborg 2024-07-22 16:09:44 +02:00 committed by Sebastian Parborg
parent 527e55239b
commit b61d308d76

View File

@ -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(&region_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(&region_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;