Commit c77cb396 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix moving single clip in group on another track with meta

Related to #382
parent 9a06f627
...@@ -1484,7 +1484,7 @@ bool TimelineModel::requestGroupMove(int itemId, int groupId, int delta_track, i ...@@ -1484,7 +1484,7 @@ bool TimelineModel::requestGroupMove(int itemId, int groupId, int delta_track, i
if (!upperTrackIsAudio) { if (!upperTrackIsAudio) {
// Dragging an audio clip up, check that upper video clip has an available video track // Dragging an audio clip up, check that upper video clip has an available video track
int targetPos = upperTrack - delta_track; int targetPos = upperTrack - delta_track;
if (targetPos <0 || getTrackById_const(getTrackIndexFromPosition(targetPos))->isAudioTrack()) { if (moveMirrorTracks && (targetPos <0 || getTrackById_const(getTrackIndexFromPosition(targetPos))->isAudioTrack())) {
delta_track = 0; delta_track = 0;
} }
} else { } else {
...@@ -1496,7 +1496,6 @@ bool TimelineModel::requestGroupMove(int itemId, int groupId, int delta_track, i ...@@ -1496,7 +1496,6 @@ bool TimelineModel::requestGroupMove(int itemId, int groupId, int delta_track, i
} }
} }
} }
if (delta_track == 0 && updateView) { if (delta_track == 0 && updateView) {
updateView = false; updateView = false;
allowViewRefresh = false; allowViewRefresh = false;
...@@ -1545,23 +1544,13 @@ bool TimelineModel::requestGroupMove(int itemId, int groupId, int delta_track, i ...@@ -1545,23 +1544,13 @@ bool TimelineModel::requestGroupMove(int itemId, int groupId, int delta_track, i
old_forced_track[item.first] = m_allCompositions[item.first]->getForcedTrack(); old_forced_track[item.first] = m_allCompositions[item.first]->getForcedTrack();
} }
} }
if (!moveMirrorTracks) { if (masterIsAudio) {
if (masterIsAudio) { // Master clip is audio, so reverse delta for video clips
// Master clip is audio, so reverse delta for video clips video_delta = -delta_track;
video_delta = 0;
} else {
audio_delta = 0;
}
} else { } else {
if (masterIsAudio) { audio_delta = -delta_track;
// Master clip is audio, so reverse delta for video clips
video_delta = -delta_track;
} else {
audio_delta = -delta_track;
}
} }
} }
// We need to insert depending on the move direction to avoid confusing the view // We need to insert depending on the move direction to avoid confusing the view
// std::reverse(std::begin(sorted_clips), std::end(sorted_clips)); // std::reverse(std::begin(sorted_clips), std::end(sorted_clips));
bool updateThisView = allowViewRefresh; bool updateThisView = allowViewRefresh;
...@@ -1645,8 +1634,10 @@ bool TimelineModel::requestGroupMove(int itemId, int groupId, int delta_track, i ...@@ -1645,8 +1634,10 @@ bool TimelineModel::requestGroupMove(int itemId, int groupId, int delta_track, i
int current_track_id = old_track_ids[item.first]; int current_track_id = old_track_ids[item.first];
int current_track_position = getTrackPosition(current_track_id); int current_track_position = getTrackPosition(current_track_id);
int d = getTrackById(current_track_id)->isAudioTrack() ? audio_delta : video_delta; int d = getTrackById(current_track_id)->isAudioTrack() ? audio_delta : video_delta;
if (!moveMirrorTracks && item.first != itemId) {
d = 0;
}
int target_track_position = current_track_position + d; int target_track_position = current_track_position + d;
if (target_track_position >= 0 && target_track_position < getTracksCount()) { if (target_track_position >= 0 && target_track_position < getTracksCount()) {
auto it = m_allTracks.cbegin(); auto it = m_allTracks.cbegin();
std::advance(it, target_track_position); std::advance(it, target_track_position);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment