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
e4796e36
Commit
e4796e36
authored
Apr 07, 2021
by
Jean-Baptiste Mardelle
Browse files
When selecting a bin clip from timeline, take care of speed in zone selection.
BUG: 425417
parent
7a9a9a03
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/bin/bin.cpp
View file @
e4796e36
...
...
@@ -1986,6 +1986,7 @@ void Bin::selectClipById(const QString &clipId, int frame, const QPoint &zone, b
if
(
activateMonitor
)
{
if
(
frame
>
-
1
)
{
m_monitor
->
slotSeek
(
frame
);
m_monitor
->
refreshMonitorIfActive
();
}
else
{
m_monitor
->
slotActivateMonitor
();
}
...
...
src/mainwindow.cpp
View file @
e4796e36
...
...
@@ -3239,14 +3239,36 @@ void MainWindow::slotClipInProjectTree()
ObjectId
id
(
ObjectType
::
TimelineClip
,
ids
.
constFirst
());
int
start
=
pCore
->
getItemIn
(
id
);
int
duration
=
pCore
->
getItemDuration
(
id
);
QPoint
zone
(
start
,
start
+
duration
);
qDebug
()
<<
" - - selecting clip on monitor, zone: "
<<
zone
;
int
pos
=
m_projectMonitor
->
position
();
int
itemPos
=
pCore
->
getItemPosition
(
id
);
if
(
pos
>=
itemPos
&&
pos
<
itemPos
+
duration
)
{
pos
-=
(
itemPos
-
start
);
}
else
{
pos
=
-
1
;
bool
containsPos
=
(
pos
>=
itemPos
&&
pos
<
itemPos
+
duration
);
double
speed
=
pCore
->
getClipSpeed
(
id
.
second
);
if
(
containsPos
)
{
pos
-=
itemPos
-
start
;
}
if
(
!
qFuzzyCompare
(
speed
,
1.
))
{
if
(
speed
>
0.
)
{
// clip has a speed effect, adjust zone
start
=
qRound
(
start
*
speed
);
duration
=
qRound
(
duration
*
speed
);
if
(
containsPos
)
{
pos
=
qRound
(
pos
*
speed
);
}
}
else
if
(
speed
<
0.
)
{
int
max
=
getMainTimeline
()
->
controller
()
->
clipMaxDuration
(
id
.
second
);
if
(
max
>
0
)
{
int
invertedPos
=
itemPos
+
duration
-
m_projectMonitor
->
position
();
start
=
qRound
((
max
-
(
start
+
duration
))
*
-
speed
);
duration
=
qRound
(
duration
*
-
speed
);
if
(
containsPos
)
{
pos
=
start
+
qRound
(
invertedPos
*
-
speed
);
}
}
}
}
QPoint
zone
(
start
,
start
+
duration
);
if
(
!
containsPos
)
{
pos
=
start
;
}
pCore
->
selectBinClip
(
getMainTimeline
()
->
controller
()
->
getClipBinId
(
ids
.
constFirst
()),
true
,
pos
,
zone
);
}
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
e4796e36
...
...
@@ -4286,3 +4286,10 @@ void TimelineController::updateMasterZones(QVariantList zones)
emit
masterZonesChanged
();
}
int
TimelineController
::
clipMaxDuration
(
int
cid
)
{
if
(
!
m_model
->
isClip
(
cid
))
{
return
-
1
;
}
return
m_model
->
m_allClips
[
cid
]
->
getMaxDuration
();
}
src/timeline2/view/timelinecontroller.h
View file @
e4796e36
...
...
@@ -622,6 +622,8 @@ public:
void
showRulerEffectZone
(
QPair
<
int
,
int
>
inOut
,
bool
checked
);
/** @brief Set the list of master effect zones */
void
updateMasterZones
(
QVariantList
zones
);
/** @brief get Maximum duration of a clip */
int
clipMaxDuration
(
int
cid
);
public
slots
:
void
resetView
();
...
...
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