summaryrefslogtreecommitdiff
path: root/src/data
diff options
context:
space:
mode:
authorAleks Kissinger <aleks0@gmail.com>2018-10-02 17:46:03 +0200
committerAleks Kissinger <aleks0@gmail.com>2018-10-02 17:46:03 +0200
commite61fb864ec68a58abdb9cc9df047b4b75801c5e7 (patch)
treef85fa5506ef776692e67c0a69a671e33d954c5f7 /src/data
parent52f2d4b7f3df910db6592ae16b1eec825b70c4d6 (diff)
fixed self-loop support
Diffstat (limited to 'src/data')
-rw-r--r--src/data/edge.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/data/edge.cpp b/src/data/edge.cpp
index b4c7ec1..ca63954 100644
--- a/src/data/edge.cpp
+++ b/src/data/edge.cpp
@@ -29,11 +29,20 @@ Edge::Edge(Node *s, Node *t, QObject *parent) :
_data = new GraphElementData();
_edgeNode = 0;
_dirty = true;
- _basicBendMode = true;
- _bend = 0;
- _inAngle = 0;
- _outAngle = 0;
- _weight = 0.4f;
+
+ if (s != t) {
+ _basicBendMode = true;
+ _bend = 0;
+ _inAngle = 0;
+ _outAngle = 0;
+ _weight = 0.4f;
+ } else {
+ _basicBendMode = false;
+ _bend = 0;
+ _inAngle = 135;
+ _outAngle = 45;
+ _weight = 1.0f;
+ }
_style = noneEdgeStyle;
updateControls();
}
@@ -227,7 +236,7 @@ void Edge::setAttributesFromData()
}
}
- if (_data->property("looseness") != 0) {
+ if (!_data->property("looseness").isNull()) {
_weight = _data->property("looseness").toFloat(&ok) / 2.5f;
if (!ok) _weight = 0.4f;
} else {