summaryrefslogtreecommitdiff
path: root/src/data/edge.cpp
diff options
context:
space:
mode:
authorGard Spreemann <gspreemann@gmail.com>2019-01-12 08:36:56 +0100
committerGard Spreemann <gspreemann@gmail.com>2019-01-12 08:36:56 +0100
commit6bf0bd3d1bce15acded6b83edabbdc329686cd7e (patch)
tree12569b7d18e006bb52dd72c649d5832e8ff6939a /src/data/edge.cpp
parent7bf0645fc8c7fd95889b7dca289fb20b4212df85 (diff)
parent579c8118f8538a7adb8c70e1909734431ecf0d10 (diff)
Merge tag 'v2.1.1' into debian/sid
Diffstat (limited to 'src/data/edge.cpp')
-rw-r--r--src/data/edge.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/data/edge.cpp b/src/data/edge.cpp
index 864d5ed..fcd9959 100644
--- a/src/data/edge.cpp
+++ b/src/data/edge.cpp
@@ -169,8 +169,10 @@ void Edge::updateControls() {
qreal bnd = static_cast<qreal>(_bend) * (M_PI / 180.0);
outAngleR = angle - bnd;
inAngleR = M_PI + angle + bnd;
- _outAngle = static_cast<int>(round(outAngleR * (180.0 / M_PI)));
- _inAngle = static_cast<int>(round(inAngleR * (180.0 / M_PI)));
+
+ // keep _inAngle and _outAngle snapped to increments of 15 degrees
+ _outAngle = static_cast<int>(roundToNearest(15.0, outAngleR * (180.0 / M_PI)));
+ _inAngle = static_cast<int>(roundToNearest(15.0, inAngleR * (180.0 / M_PI)));
} else {
outAngleR = static_cast<qreal>(_outAngle) * (M_PI / 180.0);
inAngleR = static_cast<qreal>(_inAngle) * (M_PI / 180.0);
@@ -409,7 +411,7 @@ QPointF Edge::bezierTangent(qreal start, qreal end) const
// normalise
qreal len = sqrt(dx*dx + dy*dy);
- if (almostZero(len)) {
+ if (!almostZero(len)) {
dx = (dx / len) * 0.1;
dy = (dy / len) * 0.1;
}