From ffee3e1154cfeb806f300087a7ba6351cf95a348 Mon Sep 17 00:00:00 2001 From: Till Theato Date: Fri, 31 Dec 2010 19:49:50 +0000 Subject: [PATCH] =?utf8?q?B=C3=A9zier=20spline:=20right=20click=20on=20poi?= =?utf8?q?nt=20(not=20on=20handles)=20to=20delete=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit svn path=/trunk/kdenlive/; revision=5228 --- src/beziercurve/beziersplinewidget.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/beziercurve/beziersplinewidget.cpp b/src/beziercurve/beziersplinewidget.cpp index 3ace2c42..f9761085 100644 --- a/src/beziercurve/beziersplinewidget.cpp +++ b/src/beziercurve/beziersplinewidget.cpp @@ -122,19 +122,22 @@ void BezierSplineWidget::mousePressEvent(QMouseEvent* event) double y = 1.0 - event->pos().y() / (double)(height() - 1); point_types selectedPoint; - int closest_point_index = nearestPointInRange(QPointF(x, y), width(), height(), &selectedPoint); + int closestPointIndex = nearestPointInRange(QPointF(x, y), width(), height(), &selectedPoint); - /*if (event->button() == Qt::RightButton && closest_point_index > 0 && closest_point_index < d->m_curve.points().count() - 1) { - d->m_curve.removePoint(closest_point_index); + if (event->button() == Qt::RightButton && closestPointIndex > 0 && closestPointIndex < m_spline.points().count() - 1 && selectedPoint == PTypeP) { + m_spline.removePoint(closestPointIndex); setCursor(Qt::ArrowCursor); - d->setState(ST_NORMAL); - if (closest_point_index < d->m_grab_point_index) - --d->m_grab_point_index; - d->setCurveModified(); + m_mode = ModeNormal; + if (closestPointIndex < m_currentPointIndex) + --m_currentPointIndex; + update(); + emit modified(); + return; + } else if (event->button() != Qt::LeftButton) { return; - } else*/ if (event->button() != Qt::LeftButton) return; + } - if (closest_point_index < 0) { + if (closestPointIndex < 0) { BPoint po; po.p = QPointF(x, y); po.h1 = QPointF(x-0.05, y-0.05); @@ -145,7 +148,7 @@ void BezierSplineWidget::mousePressEvent(QMouseEvent* event) return; /*if (!d->jumpOverExistingPoints(newPoint, -1)) return;*/ } else { - m_currentPointIndex = closest_point_index; + m_currentPointIndex = closestPointIndex; m_currentPointType = selectedPoint; } -- 2.39.2