From e7abced86ef09fcdeecf0dd5d4c4c8381a96363e Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Thu, 19 Oct 2023 15:41:49 +0200 Subject: [PATCH] Fix #113726: Unable to open N panel for the first time with click drag View2D isn't initialized in these regions yet, which is a valid state for hidden regions. So consider that when calculating the region zoom factor in the region scale operator. --- source/blender/editors/screen/screen_ops.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/screen/screen_ops.cc b/source/blender/editors/screen/screen_ops.cc index c5cd300d2d0..7a11b874b96 100644 --- a/source/blender/editors/screen/screen_ops.cc +++ b/source/blender/editors/screen/screen_ops.cc @@ -2862,8 +2862,10 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event) /* execute the events */ switch (event->type) { case MOUSEMOVE: { - const float aspect = BLI_rctf_size_x(&rmd->region->v2d.cur) / - (BLI_rcti_size_x(&rmd->region->v2d.mask) + 1); + const float aspect = (rmd->region->v2d.flag & V2D_IS_INIT) ? + (BLI_rctf_size_x(&rmd->region->v2d.cur) / + (BLI_rcti_size_x(&rmd->region->v2d.mask) + 1)) : + 1.0f; const int snap_size_threshold = (U.widget_unit * 2) / aspect; bool size_changed = false;