diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-01-03 07:49:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-01-03 07:50:50 +0300 |
commit | e26a527770c3c313c090a2856391463abc333ded (patch) | |
tree | 946c5a1c4675bc16814c49f0300c14b36406e9f2 /source/blender/editors | |
parent | ac7eb7108907ff20681ce8fe71723f7fa06dcdf4 (diff) |
Fix toolbar flickering on resize, inability to hide
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/screen/area_utils.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/editors/screen/area_utils.c b/source/blender/editors/screen/area_utils.c index fc76b3f7c09..a9fdaf52ee5 100644 --- a/source/blender/editors/screen/area_utils.c +++ b/source/blender/editors/screen/area_utils.c @@ -64,12 +64,17 @@ void ED_region_generic_tools_region_message_subscribe(const struct bContext *UNU int ED_region_generic_tools_region_snap_size(const ARegion *ar, int size, int axis) { if (axis == 0) { - const float aspect = BLI_rctf_size_x(&ar->v2d.cur) / (BLI_rcti_size_x(&ar->v2d.mask) + 1); - const int icon_size = ICON_DEFAULT_HEIGHT_TOOLBAR / aspect; + /* Using Y axis avoids slight feedback loop when adjusting X. */ + const float aspect = BLI_rctf_size_y(&ar->v2d.cur) / (BLI_rcti_size_y(&ar->v2d.mask) + 1); + const float icon_size = ICON_DEFAULT_HEIGHT_TOOLBAR / aspect; const float column = 1.25f * icon_size; const float margin = 0.5f * icon_size; const float snap_units[] = { - column + margin, (2.0f * column) + margin, (2.7f * column) + margin}; + 0, /* Without this we can't hide the toolbar. */ + column + margin, + (2.0f * column) + margin, + (2.7f * column) + margin, + }; int best_diff = INT_MAX; int best_size = size; /* Only snap if less than last snap unit. */ |