Hide line to control point if the center of connection is inside of the point.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-06-19 13:18:38 +03:00
parent 21b3f4b5ae
commit f2c8481f53

View File

@ -272,14 +272,23 @@ void VControlPointSpline::Init()
//---------------------------------------------------------------------------------------------------------------------
void VControlPointSpline::SetCtrlLine(const QPointF &controlPoint, const QPointF &splinePoint)
{
QPointF p1, p2;
VGObject::LineIntersectCircle(QPointF(), ScaledRadius(SceneScale(scene())),
QLineF( QPointF(), splinePoint-controlPoint), p1, p2);
QLineF line(splinePoint-controlPoint, p1);
controlLine->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
controlLine->setLine(line);
controlLine->setVisible(not line.isNull());
controlLine->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
QLineF circleLine (QPointF(), splinePoint-controlPoint);
const qreal radius = ScaledRadius(SceneScale(scene()));
if (circleLine.length() > radius)
{
QPointF p1, p2;
VGObject::LineIntersectCircle(QPointF(), radius, circleLine, p1, p2);
QLineF line(splinePoint-controlPoint, p1);
controlLine->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
controlLine->setLine(line);
controlLine->setVisible(not line.isNull());
controlLine->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
}
else
{
controlLine->setVisible(false);
}
}
//---------------------------------------------------------------------------------------------------------------------