Commit 21cd9499 authored by Julius Künzel's avatar Julius Künzel
Browse files

"Go to clip start/end" should use clip under cursor if none is selected

BUG: 440024
FIXED-IN: 21.12.0
parent 7e1a2251
......@@ -1745,13 +1745,21 @@ bool TimelineController::requestSpacerEndOperation(int clipId, int startPosition
void TimelineController::seekCurrentClip(bool seekToEnd)
{
const auto selection = m_model->getCurrentSelection();
int cid = -1;
if (!selection.empty()) {
int cid = *selection.begin();
int start = m_model->getItemPosition(cid);
if (seekToEnd) {
start += m_model->getItemPlaytime(cid);
cid = *selection.begin();
} else {
int cursorPos = pCore->getTimelinePosition();
cid = m_model->getClipByPosition(m_activeTrack, cursorPos);
if (cid < 0) {
/* If the cursor is at the clip end it is one frame after the clip,
* make it possible to jump to the clip start in that situation too
*/
cid = m_model->getClipByPosition(m_activeTrack, cursorPos - 1);
}
setPosition(start);
}
if (cid > -1) {
seekToClip(cid, seekToEnd);
}
}
......
......@@ -463,7 +463,7 @@ public:
void switchTargetTrack();
const QString getTrackNameFromIndex(int trackIndex);
/** @brief Seeks to selected clip start / end
/** @brief Seeks to selected clip start / end or, if none is selected, to the start / end of the clip under the cursor
*/
void seekCurrentClip(bool seekToEnd = false);
/** @brief Seeks to a clip start (or end) based on it's clip id
......
Supports Markdown
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