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
177250f5
Commit
177250f5
authored
Nov 09, 2021
by
Jean-Baptiste Mardelle
Browse files
When resizing an unaligned mix, increase/decrease left/right side alternatively for better result.
Related to
#796
parent
a570f04c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/timelinemodel.cpp
View file @
177250f5
...
...
@@ -5751,9 +5751,35 @@ void TimelineModel::requestResizeMix(int cid, int duration, MixAlignment align,
updatedDurationRight
=
m_allClips
.
at
(
cid
)
->
getMixCutPosition
();
updatedDurationLeft
=
m_allClips
.
at
(
cid
)
->
getMixDuration
()
-
updatedDurationRight
;
int
currentDuration
=
m_allClips
.
at
(
cid
)
->
getMixDuration
();
double
ratio
=
double
(
duration
)
/
currentDuration
;
updatedDurationRight
*=
ratio
;
updatedDurationLeft
=
duration
-
updatedDurationRight
;
if
(
qAbs
(
duration
-
currentDuration
)
==
1
)
{
if
(
duration
<
currentDuration
)
{
// We are reducing the duration
if
(
currentDuration
%
2
==
0
)
{
updatedDurationRight
--
;
if
(
updatedDurationRight
<
0
)
{
updatedDurationRight
=
0
;
updatedDurationLeft
--
;
}
}
else
{
updatedDurationLeft
--
;
if
(
updatedDurationLeft
<
0
)
{
updatedDurationLeft
=
0
;
updatedDurationRight
--
;
}
}
}
else
{
// Increasing duration
if
(
currentDuration
%
2
==
0
)
{
updatedDurationRight
++
;
}
else
{
updatedDurationLeft
++
;
}
}
}
else
{
double
ratio
=
double
(
duration
)
/
currentDuration
;
updatedDurationRight
*=
ratio
;
updatedDurationLeft
=
duration
-
updatedDurationRight
;
}
}
if
(
updatedDurationLeft
+
updatedDurationRight
<
1
)
{
//
...
...
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