diff options
author | Sergey Sharybin <sergey@blender.org> | 2022-03-24 18:55:57 +0300 |
---|---|---|
committer | Fabian Schempp <fabianschempp@googlemail.com> | 2022-04-11 01:31:45 +0300 |
commit | f8ff378d6ae5119a2469f32ddbc7af3d34ea0ed5 (patch) | |
tree | b08f1820ca45b00ebd0139408b4fa5119def3921 /source/blender/editors/space_clip/tracking_ops.c | |
parent | e8ad7cac5bcdfe668c5fdd4fb90ab55d8a7114e7 (diff) |
Tracking: Fix incorrect angle calculation on marker slide
Now the mouse cursor will exactly follow the tilt/scale sliding area.
Diffstat (limited to 'source/blender/editors/space_clip/tracking_ops.c')
-rw-r--r-- | source/blender/editors/space_clip/tracking_ops.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 1a497a35b6f..e7bdbfe7c68 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -877,14 +877,23 @@ static int slide_marker_modal(bContext *C, wmOperator *op, const wmEvent *event) } else if (data->action == SLIDE_ACTION_TILT_SIZE) { const float mouse_delta[2] = {dx, dy}; - float start[2], end[2]; - float scale = 1.0f, angle = 0.0f; + /* Vector which connects marker position with tilt/scale sliding area before sliding + * began. */ + float start[2]; sub_v2_v2v2(start, data->spos, data->old_pos); + start[0] *= data->width; + start[1] *= data->height; + /* Vector which connects marker position with tilt/scale sliding area with the sliding + * delta applied. */ + float end[2]; add_v2_v2v2(end, data->spos, mouse_delta); sub_v2_v2(end, data->old_pos); + end[0] *= data->width; + end[1] *= data->height; + float scale = 1.0f; if (len_squared_v2(start) != 0.0f) { scale = len_v2(end) / len_v2(start); @@ -893,7 +902,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, const wmEvent *event) } } - angle = -angle_signed_v2v2(start, end); + const float angle = -angle_signed_v2v2(start, end); for (int a = 0; a < 4; a++) { float vec[2]; |