diff options
author | Sebastian Parborg <darkdefende@gmail.com> | 2019-07-31 19:16:37 +0300 |
---|---|---|
committer | Sebastian Parborg <darkdefende@gmail.com> | 2019-07-31 19:16:37 +0300 |
commit | bcda8cc89b88c999ff64edcc19973d6289bcbf2a (patch) | |
tree | d8dc110ba901bdbed8289f09682c32ce85e6888a /source/blender/editors/space_image | |
parent | 0516d49d0ca59044c36986c360eaa485020da044 (diff) |
Fix T65837: "Zoom Axis" is not working on the node editor
We would not take into account the user "Zoom Axis" setting in certain
2D space viewports. In addition to this, the "Scale Zoom" didn't work
consistently in these spaces either.
Reviewed By: Brecht
Differential Revision: http://developer.blender.org/D5132
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index b79ed1c83c4..374a58d1808 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -556,39 +556,36 @@ static void image_zoom_apply(ViewZoomData *vpd, const bool zoom_to_pos) { float factor; + float delta; - if (viewzoom == USER_ZOOM_CONT) { - double time = PIL_check_seconds_timer(); - float time_step = (float)(time - vpd->timer_lastdraw); - float fac; - float zfac; - + if (viewzoom != USER_ZOOM_SCALE) { if (U.uiflag & USER_ZOOM_HORIZ) { - fac = (float)(x - vpd->origx); + delta = (float)(x - vpd->origx); } else { - fac = (float)(y - vpd->origy); + delta = (float)(y - vpd->origy); } + } + else { + delta = x - vpd->origx + y - vpd->origy; + } - if (zoom_invert) { - fac = -fac; - } + if (zoom_invert) { + delta = -delta; + } + + if (viewzoom == USER_ZOOM_CONT) { + double time = PIL_check_seconds_timer(); + float time_step = (float)(time - vpd->timer_lastdraw); + float zfac; /* oldstyle zoom */ - zfac = 1.0f + ((fac / 20.0f) * time_step); + zfac = 1.0f + ((delta / 20.0f) * time_step); vpd->timer_lastdraw = time; /* this is the final zoom, but instead make it into a factor */ - // zoom = vpd->sima->zoom * zfac; factor = (vpd->sima->zoom * zfac) / vpd->zoom; } else { - /* for now do the same things for scale and dolly */ - float delta = x - vpd->origx + y - vpd->origy; - - if (zoom_invert) { - delta *= -1.0f; - } - factor = 1.0f + delta / 300.0f; } |