Fix #126191: Both handle seqslide modal cancel

The issue was that if the seqslide was cancelled such that the
`new_frame` of the left handle was greater than its previous
right_handle (before the cancel), `SEQ_time_left_handle_frame_set()`
would clamp this value and so the left handle would not properly restore
itself.

Fix by updating both handles at once (right handle first) if both
handles are selected and the cancel jump travels in the right direction.

This also seems to fix the situation where strips w/ both handles
selected would be erroneously detected as overlapping when moving them
rapidly side to side.

Pull Request: https://projects.blender.org/blender/blender/pulls/128740
This commit is contained in:
John Kiril Swenson
2024-10-14 00:49:01 +02:00
committed by Richard Antalik
parent bdee3dfaa2
commit 72be365c6b

View File

@@ -602,6 +602,15 @@ static void flushTransSeq(TransInfo *t)
break;
}
case SEQ_LEFTSEL: { /* No vertical transform. */
/* Update right handle first if both handles are selected and the new_frame is right of
* the old one to avoid unexpected left handle clamping when cancelling. See #126191. */
bool both_handles_selected = (tdsq->flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) ==
(SEQ_LEFTSEL | SEQ_RIGHTSEL);
if (both_handles_selected && new_frame > SEQ_time_left_handle_frame_get(scene, seq)) {
a++, td++, td2d++;
int new_right_frame = round_fl_to_int(td->loc[0] + edge_pan_offset[0]);
SEQ_time_right_handle_frame_set(scene, seq, new_right_frame);
}
int old_startdisp = SEQ_time_left_handle_frame_get(scene, seq);
SEQ_time_left_handle_frame_set(t->scene, seq, new_frame);