Make cut tool apply on clicked clip

parent 9f895815
......@@ -369,7 +369,8 @@ Rectangle {
menu.popup()
} else {
if (root.activeTool === 1 && mouse.y > ruler.height) {
timeline.cutClipUnderCursor((scrollView.flickableItem.contentX + mouse.x) / timeline.scaleFactor)
var y = mouse.y - ruler.height
timeline.cutClipUnderCursor((scrollView.flickableItem.contentX + mouse.x) / timeline.scaleFactor, tracksRepeater.itemAt(Logic.getTrackIndexFromPos(y)).trackId)
} else {
timeline.seekPosition = (scrollView.flickableItem.contentX + mouse.x) / timeline.scaleFactor
timeline.position = timeline.seekPosition
......@@ -382,9 +383,11 @@ Rectangle {
scim = false
}
onPositionChanged: {
if ( mouse.buttons === Qt.LeftButton) {
timeline.seekPosition = (scrollView.flickableItem.contentX + mouse.x) / timeline.scaleFactor
timeline.position = timeline.seekPosition
if (mouse.buttons === Qt.LeftButton) {
if (root.activeTool === 0) {
timeline.seekPosition = (scrollView.flickableItem.contentX + mouse.x) / timeline.scaleFactor
timeline.position = timeline.seekPosition
}
scim = true
}
else {
......
......@@ -437,7 +437,7 @@ void TimelineController::setZoneOut(int outPoint)
emit zoneMoved(m_zone);
}
void TimelineController::cutClipUnderCursor(int position)
void TimelineController::cutClipUnderCursor(int position, int track)
{
if (position == -1) {
position = m_position;
......@@ -449,12 +449,14 @@ void TimelineController::cutClipUnderCursor(int position)
}
}
if (!foundClip) {
QVariant returnedValue;
QMetaObject::invokeMethod(m_root, "currentTrackId",
Q_RETURN_ARG(QVariant, returnedValue));
int trackId = returnedValue.toInt();
if (trackId >= 0) {
int cid = m_model->getClipByPosition(trackId, position);
if (track == -1) {
QVariant returnedValue;
QMetaObject::invokeMethod(m_root, "currentTrackId",
Q_RETURN_ARG(QVariant, returnedValue));
track = returnedValue.toInt();
}
if (track >= 0) {
int cid = m_model->getClipByPosition(track, position);
if (cid >= 0) {
m_model->requestClipCut(cid, position);
foundClip = true;
......
......@@ -190,7 +190,7 @@ public:
void checkDuration();
/* @brief Cuts the clip on current track at timeline position
*/
Q_INVOKABLE void cutClipUnderCursor(int position = -1);
Q_INVOKABLE void cutClipUnderCursor(int position = -1, int track = -1);
/* @brief Seeks to selected clip start / end
*/
void seekCurrentClip(bool seekToEnd = false);
......
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