diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2015-08-25 17:07:30 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2015-08-25 17:07:30 +0300 |
commit | c558d7222876c7998e7c05a51f25f9474fbe9ffa (patch) | |
tree | 58e368fa4d40841482a24f1a2de5eb910f7354c4 | |
parent | 88620cd265526711fb69f846d8475188b18bdb78 (diff) |
Increase stability of WALK_MOUSE_MOVEVERTICAL mode (MMB) by doing only one movement at a time
-rw-r--r-- | source/blender/editors/space_view3d/view3d_walk.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index 37936f3cac7..9179df1b5a3 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -1197,15 +1197,21 @@ static int walkApply(bContext *C, wmOperator *op, WalkInfo *walk) } case WALK_MOUSE_MOVEVERTICAL: { - if (moffset[0] > 0) - walk_mouse_move(walk, mat, WALK_BIT_RIGHT, time_redraw, dvec); - else if (moffset[0] < 0) - walk_mouse_move(walk, mat, WALK_BIT_LEFT, time_redraw, dvec); - - if (moffset[1] > 0) - walk_mouse_move(walk, mat, WALK_BIT_UP, time_redraw, dvec); - else if (moffset[1] < 0) - walk_mouse_move(walk, mat, WALK_BIT_DOWN, time_redraw, dvec); + /* if we both movements at the same time the effect is too unstable */ + const bool is_vertical = (abs(moffset[1]) - abs(moffset[0])) > 0; + + if (is_vertical) { + if (moffset[1] > 0) + walk_mouse_move(walk, mat, WALK_BIT_UP, time_redraw, dvec); + else if (moffset[1] < 0) + walk_mouse_move(walk, mat, WALK_BIT_DOWN, time_redraw, dvec); + } + else { + if (moffset[0] > 0) + walk_mouse_move(walk, mat, WALK_BIT_RIGHT, time_redraw, dvec); + else if (moffset[0] < 0) + walk_mouse_move(walk, mat, WALK_BIT_LEFT, time_redraw, dvec); + } break; } |