Fix: Reset Widths After Hiding Region

Some regions, like toolbars and sidebars, can be dragged open and
closed. But this often doesn't work correctly a second time because
we don't update our saved widths once the area is hidden. This results
in an incorrect offset. This PR just resets the saved widths to zero
when the region is hidden so this doesn't occur. Note that this does
not affect the ability to just click and release on the widget, only
dragging from it.

Pull Request: https://projects.blender.org/blender/blender/pulls/136527
This commit is contained in:
Harley Acheson
2025-03-26 00:29:27 +01:00
committed by Harley Acheson
parent b729928897
commit d9dbd1bafd

View File

@@ -2888,6 +2888,17 @@ static wmOperatorStatus region_scale_invoke(bContext *C, wmOperator *op, const w
rmd->region->sizey = rmd->region->winy;
}
/* Reset our saved widths if the region is hidden.
* Otherwise you can't drag it out a second time. */
if (rmd->region->flag & RGN_FLAG_HIDDEN) {
if (ELEM(rmd->edge, AE_LEFT_TO_TOPRIGHT, AE_RIGHT_TO_TOPLEFT)) {
rmd->region->winx = rmd->region->sizex = 0;
}
else {
rmd->region->winy = rmd->region->sizey = 0;
}
}
/* Now copy to region-move-data. */
if (ELEM(rmd->edge, AE_LEFT_TO_TOPRIGHT, AE_RIGHT_TO_TOPLEFT)) {
rmd->origval = rmd->region->sizex;