]> git.sesse.net Git - kdenlive/commitdiff
Bezier Spline: Fix handles sometimes not detected as linked because of rounding problems
authorTill Theato <root@ttill.de>
Thu, 6 Jan 2011 09:59:11 +0000 (09:59 +0000)
committerTill Theato <root@ttill.de>
Thu, 6 Jan 2011 09:59:11 +0000 (09:59 +0000)
svn path=/trunk/kdenlive/; revision=5276

src/beziercurve/bpoint.cpp

index 2c5496555fec85873970f850f908ded8da5638d9..15bb911259be2bf0563f52e8b918326b4a06c572 100644 (file)
@@ -90,5 +90,8 @@ void BPoint::keepInRange(qreal xMin, qreal xMax)
 
 void BPoint::autoSetLinked()
 {
-    handlesLinked = !QLineF(h1, p).angleTo(QLineF(p, h2));
+    // sometimes the angle is returned as 360°
+    // due to rounding problems the angle is sometimes not quite 0
+    qreal angle = QLineF(h1, p).angleTo(QLineF(p, h2));
+    handlesLinked = angle < 1e-3 || qRound(angle) == 360;
 }