Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Start fixing group move

parent 74ecb827
......@@ -383,24 +383,26 @@ int TimelineModel::suggestClipMove(int clipId, int trackId, int position, int sn
}
}
// we check if move is possible
Fun undo = []() { return true; };
Fun redo = []() { return true; };
bool possible = requestClipMove(clipId, trackId, position, false, false, undo, redo);
qDebug() << "Original move success" << possible;
bool possible = requestClipMove(clipId, trackId, position, false, false, false);
//bool possible = requestClipMove(clipId, trackId, position, false, false, undo, redo);
if (possible) {
undo();
return position;
}
bool after = position > currentPos;
int blank_length = getTrackById(trackId)->getBlankSizeNearClip(clipId, after);
qDebug() << "Found blank" << blank_length;
if (blank_length < INT_MAX) {
if (after) {
return currentPos + blank_length;
// Find best possible move
if (!m_groups->isInGroup(clipId)) {
// Easy
bool after = position > currentPos;
int blank_length = getTrackById(trackId)->getBlankSizeNearClip(clipId, after);
qDebug() << "Found blank" << blank_length;
if (blank_length < INT_MAX) {
if (after) {
return currentPos + blank_length;
}
return currentPos - blank_length;
}
return currentPos - blank_length;
}
return position;
//TODO: find best pos for groups
return currentPos;
}
int TimelineModel::suggestCompositionMove(int compoId, int trackId, int position, int snapDistance)
......
......@@ -238,7 +238,8 @@ Rectangle {
}
onPositionChanged: {
if (pressed) {
if (mouse.y < 0 || (mouse.y > height && parentTrack.rootIndex.row < tracksRepeater.count - 1)) {
var trackIndex = Logic.getTrackIndexFromId(clipRoot.trackId)
if ((mouse.y < 0 && trackIndex > 0) || (mouse.y > height && trackIndex < tracksRepeater.count - 1)) {
var mapped = parentTrack.mapFromItem(clipRoot, mouse.x, mouse.y).x
clipRoot.draggedToTrack(clipRoot, mapToItem(null, 0, mouse.y).y, mapped)
} else {
......
......@@ -265,7 +265,7 @@ Column{
clip.x = Math.max(0, clip.x)
var frame = Math.round(clip.x / timeScale)
frame = controller.suggestClipMove(cIndex, toTrack, frame, root.snapping);
if (!controller.requestClipMove(cIndex, toTrack, frame, false, false, false)) {
if (clip.currentFrame == frame) {
// Abort move
clip.x = clip.draggedX
} else {
......
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