]> git.sesse.net Git - kdenlive/commitdiff
Bézier spline widget: Fix new points not shown immediately when added close to existi...
authorTill Theato <root@ttill.de>
Sat, 1 Jan 2011 12:28:48 +0000 (12:28 +0000)
committerTill Theato <root@ttill.de>
Sat, 1 Jan 2011 12:28:48 +0000 (12:28 +0000)
svn path=/trunk/kdenlive/; revision=5230

src/beziercurve/beziersplinewidget.cpp
src/beziercurve/cubicbezierspline.cpp

index f97610854dfb69a2920ddbbf2890f22a52aed7ab..8f6eff0de98102de8b4656fa63af9f6271ebe55e 100644 (file)
@@ -144,8 +144,6 @@ void BezierSplineWidget::mousePressEvent(QMouseEvent* event)
         po.h2 = QPointF(x+0.05, y+0.05);
         m_currentPointIndex = m_spline.addPoint(po);
         m_currentPointType = PTypeP;
-        if (m_currentPointIndex == -1) // x already in use
-            return;
         /*if (!d->jumpOverExistingPoints(newPoint, -1)) return;*/
     } else {
         m_currentPointIndex = closestPointIndex;
index 0671f72ba05bf05780a5b5bbe64a969f07f05e3e..d2249332b383c6f7a242627f47fdd98a846b4836 100644 (file)
@@ -128,7 +128,16 @@ int CubicBezierSpline::addPoint(const BPoint& point)
     keepSorted();
     validatePoints();
     m_validSpline = false;
-    return m_points.indexOf(point);
+    if (m_points.indexOf(point) == -1) {
+        // point changed during validation process
+        for (int i = 0; i < m_points.count(); ++i) {
+            // this condition should be sufficient, too
+            if (m_points.at(i).p == point.p)
+                return i;
+        }
+    } else {
+        return m_points.indexOf(point);
+    }
 }
 
 void CubicBezierSpline::setPrecision(int pre)