From: Till Theato Date: Sat, 1 Jan 2011 12:28:48 +0000 (+0000) Subject: Bézier spline widget: Fix new points not shown immediately when added close to existi... X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=6962205e2e8db1148bc418236652121c16341d68;p=kdenlive Bézier spline widget: Fix new points not shown immediately when added close to existing points svn path=/trunk/kdenlive/; revision=5230 --- diff --git a/src/beziercurve/beziersplinewidget.cpp b/src/beziercurve/beziersplinewidget.cpp index f9761085..8f6eff0d 100644 --- a/src/beziercurve/beziersplinewidget.cpp +++ b/src/beziercurve/beziersplinewidget.cpp @@ -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; diff --git a/src/beziercurve/cubicbezierspline.cpp b/src/beziercurve/cubicbezierspline.cpp index 0671f72b..d2249332 100644 --- a/src/beziercurve/cubicbezierspline.cpp +++ b/src/beziercurve/cubicbezierspline.cpp @@ -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)