Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
0f144df5
Commit
0f144df5
authored
Sep 23, 2020
by
Jean-Baptiste Mardelle
Browse files
Ensure a mixed clip cannot be moved further than its counterpart mix clip
parent
c69bc854
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/timelinemodel.cpp
View file @
0f144df5
...
...
@@ -659,7 +659,7 @@ bool TimelineModel::requestClipMove(int clipId, int trackId, int position, bool
return
true
;
};
if
(
old_trackId
==
trackId
)
{
// We are moving a
grou
p on same track
// We are moving a
cli
p on same track
if
(
finalMove
&&
position
>=
mixData
.
first
.
firstClipInOut
.
second
)
{
int
subPlaylist
=
m_allClips
[
clipId
]
->
getSubPlaylistIndex
();
update_playlist
=
[
this
,
clipId
,
subPlaylist
]()
{
...
...
@@ -1139,6 +1139,27 @@ QVariantList TimelineModel::suggestClipMove(int clipId, int trackId, int positio
position
=
snapped
;
}
}
if
(
sourceTrackId
==
trackId
)
{
// Same track move, check if there is a mix and limit move
std
::
pair
<
MixInfo
,
MixInfo
>
mixData
=
getTrackById_const
(
trackId
)
->
getMixInfo
(
clipId
);
if
(
mixData
.
first
.
firstClipId
>
-
1
)
{
// Clip has start mix
int
clipDuration
=
m_allClips
[
clipId
]
->
getPlaytime
();
// ensure we don't move before first clip
position
=
qMax
(
position
,
mixData
.
first
.
firstClipInOut
.
first
);
if
(
position
+
clipDuration
<=
mixData
.
first
.
firstClipInOut
.
second
)
{
position
=
mixData
.
first
.
firstClipInOut
.
second
-
clipDuration
+
2
;
}
}
if
(
mixData
.
second
.
firstClipId
>
-
1
)
{
// Clip has end mix
int
clipDuration
=
m_allClips
[
clipId
]
->
getPlaytime
();
position
=
qMin
(
position
,
mixData
.
second
.
secondClipInOut
.
first
);
if
(
position
+
clipDuration
>=
mixData
.
second
.
secondClipInOut
.
second
)
{
position
=
mixData
.
second
.
secondClipInOut
.
second
-
clipDuration
-
2
;
}
}
}
// we check if move is possible
bool
possible
=
(
m_editMode
==
TimelineMode
::
NormalEdit
)
?
requestClipMove
(
clipId
,
trackId
,
position
,
moveMirrorTracks
,
true
,
false
,
false
)
:
requestFakeClipMove
(
clipId
,
trackId
,
position
,
true
,
false
,
false
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment