From 812bc030b74feff6c0eea4da6236e67d9b4e721b Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Thu, 7 Jul 2011 16:53:49 +0000 Subject: [PATCH] Fix timeline corruption because resizing a clip end could overlap another clip in some cases svn path=/trunk/kdenlive/; revision=5775 --- src/abstractclipitem.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/abstractclipitem.cpp b/src/abstractclipitem.cpp index d294df38..030ec846 100644 --- a/src/abstractclipitem.cpp +++ b/src/abstractclipitem.cpp @@ -203,19 +203,22 @@ void AbstractClipItem::resizeEnd(int posx) setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height()); if (durationDiff > GenTime()) { QList collisionList = collidingItems(Qt::IntersectsItemBoundingRect); + bool fixItem = false; for (int i = 0; i < collisionList.size(); ++i) { if (!collisionList.at(i)->isEnabled()) continue; QGraphicsItem *item = collisionList.at(i); if (item->type() == type() && item->pos().x() > pos().x()) { - kDebug() << "///////// COLLISION DETECTED!!!!!!!!!"; - kDebug() << "///////// CURRENT: " << startPos().frames(25) << "x" << endPos().frames(25) << ", RECT: " << rect() << "-" << pos(); - kDebug() << "///////// COLLISION: " << ((AbstractClipItem *)item)->startPos().frames(25) << "x" << ((AbstractClipItem *)item)->endPos().frames(25) << ", RECT: " << ((AbstractClipItem *)item)->rect() << "-" << item->pos(); + //kDebug() << "///////// COLLISION DETECTED!!!!!!!!!"; + //kDebug() << "///////// CURRENT: " << startPos().frames(25) << "x" << endPos().frames(25) << ", RECT: " << rect() << "-" << pos(); + //kDebug() << "///////// COLLISION: " << ((AbstractClipItem *)item)->startPos().frames(25) << "x" << ((AbstractClipItem *)item)->endPos().frames(25) << ", RECT: " << ((AbstractClipItem *)item)->rect() << "-" << item->pos(); GenTime diff = ((AbstractClipItem *)item)->startPos() - startPos(); - m_info.cropDuration = diff; - setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height()); - break; + if (fixItem == false || diff < m_info.cropDuration) { + fixItem = true; + m_info.cropDuration = diff; + } } } + if (fixItem) setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height()); } } -- 2.39.2