diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-01-03 08:40:10 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-01-03 08:40:10 +0300 |
commit | 846c034323784ac938249b08ad622753d4f3dd34 (patch) | |
tree | 7086e9da51db5d3c375d3d3aa562309bf804dab7 /source/blender/editors/screen | |
parent | eb6ca6cf9f28d8b30996e1dfd7c2fc7e4fcbc768 (diff) |
UI: scale region hide threshold by zoom level
Resolves issue were it wasn't possible to have a single column toolbar
when zoomed out.
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/area_utils.c | 1 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 10 |
2 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/editors/screen/area_utils.c b/source/blender/editors/screen/area_utils.c index a9fdaf52ee5..12de1ddb795 100644 --- a/source/blender/editors/screen/area_utils.c +++ b/source/blender/editors/screen/area_utils.c @@ -70,7 +70,6 @@ int ED_region_generic_tools_region_snap_size(const ARegion *ar, int size, int ax const float column = 1.25f * icon_size; const float margin = 0.5f * icon_size; const float snap_units[] = { - 0, /* Without this we can't hide the toolbar. */ column + margin, (2.0f * column) + margin, (2.7f * column) + margin, diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index f5ce026e6d6..dd09def2df6 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2666,7 +2666,8 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event) /* region sizes now get multiplied */ delta /= UI_DPI_FAC; - rmd->ar->sizex = rmd->origval + delta; + const int size_no_snap = rmd->origval + delta; + rmd->ar->sizex = size_no_snap; if (rmd->ar->type->snap_size) { short sizex_test = rmd->ar->type->snap_size(rmd->ar, rmd->ar->sizex, 0); @@ -2676,7 +2677,7 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event) } CLAMP(rmd->ar->sizex, 0, rmd->maxsize); - if (rmd->ar->sizex < UI_UNIT_X) { + if (size_no_snap < UI_UNIT_X / aspect) { rmd->ar->sizex = rmd->origval; if (!(rmd->ar->flag & RGN_FLAG_HIDDEN)) { region_scale_toggle_hidden(C, rmd); @@ -2698,7 +2699,8 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event) /* region sizes now get multiplied */ delta /= UI_DPI_FAC; - rmd->ar->sizey = rmd->origval + delta; + const int size_no_snap = rmd->origval + delta; + rmd->ar->sizey = size_no_snap; if (rmd->ar->type->snap_size) { short sizey_test = rmd->ar->type->snap_size(rmd->ar, rmd->ar->sizey, 1); @@ -2711,7 +2713,7 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event) /* note, 'UI_UNIT_Y/4' means you need to drag the footer and execute region * almost all the way down for it to become hidden, this is done * otherwise its too easy to do this by accident */ - if (rmd->ar->sizey < UI_UNIT_Y / 4) { + if (size_no_snap < (UI_UNIT_Y / 4) / aspect) { rmd->ar->sizey = rmd->origval; if (!(rmd->ar->flag & RGN_FLAG_HIDDEN)) { region_scale_toggle_hidden(C, rmd); |