Skip to content

Commit

Permalink
WIP Fix a typo in Qan.EdgeTemplate src shape circle.
Browse files Browse the repository at this point in the history
#65

Signed-off-by: cneben <[email protected]>
  • Loading branch information
cneben committed Sep 18, 2018
1 parent 1f01cd4 commit 4cf8b9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/EdgeTemplate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ Item {
strokeWidth: 2
startX: 0; startY: 0
PathArc {
relativeX: edgeItem.dstA2.x; relativeY: edgeItem.dstA2.y
radiusX: edgeItem.dstA1.x; radiusY: edgeItem.dstA1.y;
relativeX: edgeItem.srcA2.x; relativeY: edgeItem.srcA2.y
radiusX: edgeItem.srcA1.x; radiusY: edgeItem.srcA1.y;
}
PathArc {
relativeX: -edgeItem.dstA2.x; relativeY: edgeItem.dstA2.y
radiusX: edgeItem.dstA1.x; radiusY: edgeItem.dstA1.y;
relativeX: -edgeItem.srcA2.x; relativeY: edgeItem.srcA2.y
radiusX: edgeItem.srcA1.x; radiusY: edgeItem.srcA1.y;
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/qanEdgeItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ void EdgeItem::generateArrowGeometry(GeometryCache& cache) const noexcept
generateArrowAngle(cache.p2, cache.p1, cache.srcAngle,
cache.c2, cache.c1,
cache.lineType,
getDstShape(),
getSrcShape(),
arrowLength);

// Update destination arrow cache points
Expand All @@ -517,7 +517,6 @@ void EdgeItem::generateArrowGeometry(GeometryCache& cache) const noexcept
cache.lineType,
getDstShape(),
arrowLength);

}

void EdgeItem::generateArrowAngle(QPointF& p1, QPointF& p2, qreal& angle,
Expand All @@ -532,7 +531,7 @@ void EdgeItem::generateArrowAngle(QPointF& p1, QPointF& p2, qreal& angle,
if ( lineType == qan::EdgeStyle::LineType::Straight ) {
if ( line.length() > MinLength && // Protect line.length() DIV0
arrowShape != ArrowShape::None) // Do not correct edge extremity by arrowLength if there is not arrow
p2 = line.pointAt( 1.0 - (arrowLength/line.length()) );
p2 = line.pointAt( 1.0 - (arrowLength / line.length()) );
angle = lineAngle(line);
} else if ( lineType == qan::EdgeStyle::LineType::Curved ) {
// Generate arrow orientation:
Expand All @@ -554,7 +553,7 @@ void EdgeItem::generateArrowAngle(QPointF& p1, QPointF& p2, qreal& angle,
QVector2D dstVector{ QPointF{c2.x() - p2.x(), c2.y() - p2.y()} };
dstVector.normalize();
dstVector *= static_cast<float>(arrowLength);
p2 = p2 + dstVector.toPointF();
p2 = QPointF{p2} + dstVector.toPointF();
}
}
}
Expand Down

0 comments on commit 4cf8b9c

Please sign in to comment.