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.
This commit is contained in:
Julian Eisel
2023-10-19 15:41:49 +02:00
parent d6b8422193
commit e7abced86e

View File

@@ -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;