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

Fix crash in composition move, fix qml anchor error and snap items on first drag in timeline

parent ad1081ba
......@@ -86,7 +86,6 @@ bool CompositionModel::requestResize(int size, bool right, Fun &undo, Fun &redo)
}
Fun operation = [in, out, track_operation, this]() {
if (track_operation()) {
setInOut(in, out);
return true;
}
return false;
......@@ -99,7 +98,6 @@ bool CompositionModel::requestResize(int size, bool right, Fun &undo, Fun &redo)
}
Fun reverse = [old_in, old_out, track_reverse, this]() {
if (track_reverse()) {
setInOut(old_in, old_out);
return true;
}
return false;
......
......@@ -638,12 +638,12 @@ int TrackModel::getBlankEnd(int position)
Fun TrackModel::requestCompositionResize_lambda(int compoId, int in, int out)
{
QWriteLocker locker(&m_lock);
qDebug() << "compo resize " << compoId << in << out;
int compo_position = m_allCompositions[compoId]->getPosition();
Q_ASSERT(m_compoPos.count(compo_position) > 0);
Q_ASSERT(m_compoPos[compo_position] == compoId);
int old_in = compo_position;
int old_out = old_in + m_allCompositions[compoId]->getPlaytime();
qDebug() << "compo resize " << compoId << in <<"-"<< out<<" / "<<old_in <<"-"<< old_out;
if (out == -1) {
out = in + old_out - old_in;
}
......@@ -679,7 +679,7 @@ Fun TrackModel::requestCompositionResize_lambda(int compoId, int in, int out)
return [in, out, compoId, update_snaps, this]() {
m_compoPos.erase(m_allCompositions[compoId]->getPosition());
m_allCompositions[compoId]->setInOut(in, out);
update_snaps(m_allCompositions[compoId]->getPosition(), m_allCompositions[compoId]->getPosition() + out - in + 1);
update_snaps(in, out + 1);
m_compoPos[m_allCompositions[compoId]->getPosition()] = compoId;
return true;
};
......
......@@ -239,20 +239,19 @@ Item {
onPressed: {
root.stopScrolling = true
compositionRoot.originalX = mapToItem(null, x, y).x
compositionRoot.originalX = compositionRoot.x
compositionRoot.originalDuration = clipDuration
parent.anchors.left = undefined
}
onReleased: {
root.stopScrolling = false
parent.anchors.left = compositionRoot.left
parent.anchors.left = displayRect.left
compositionRoot.trimmedIn(compositionRoot)
parent.opacity = 0
}
onPositionChanged: {
if (mouse.buttons === Qt.LeftButton) {
compositionRoot.draggedX = mapToItem(null, x, y).x
var delta = Math.round((draggedX - originalX) / timeScale)
var delta = Math.round((trimIn.x) / timeScale)
if (delta !== 0) {
var newDuration = compositionRoot.clipDuration - delta
compositionRoot.trimmingIn(compositionRoot, newDuration, mouse)
......@@ -265,9 +264,9 @@ Item {
}
Rectangle {
id: trimOut
anchors.right: parent.right
anchors.right: displayRect.right
anchors.rightMargin: 0
height: parent.height
height: displayRect.height
width: 5
color: 'red'
opacity: 0
......@@ -291,7 +290,7 @@ Item {
}
onReleased: {
root.stopScrolling = false
parent.anchors.right = compositionRoot.right
parent.anchors.right = displayRect.right
compositionRoot.trimmedOut(compositionRoot)
}
onPositionChanged: {
......
......@@ -150,6 +150,7 @@ Rectangle {
var track = Logic.getTrackIdFromPos(drag.y)
if (track !=-1) {
var frame = Math.round((drag.x + scrollView.flickableItem.contentX) / timeline.scaleFactor)
frame = controller.suggestSnapPoint(frame, root.snapping)
if (clipBeingDroppedId >= 0){
controller.requestCompositionMove(clipBeingDroppedId, track, frame, true, false)
continuousScrolling(drag.x + scrollView.flickableItem.contentX)
......@@ -219,6 +220,7 @@ Rectangle {
if (clipBeingMovedId == -1) {
var track = Logic.getTrackIdFromPos(drag.y)
var frame = Math.round((drag.x + scrollView.flickableItem.contentX) / timeline.scaleFactor)
frame = controller.suggestSnapPoint(frame, root.snapping)
if (clipBeingDroppedId >= 0){
controller.requestClipMove(clipBeingDroppedId, track, frame, true, false)
continuousScrolling(drag.x + scrollView.flickableItem.contentX)
......
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