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) void VControlPointSpline::SetCtrlLine(const QPointF &controlPoint, const QPointF &splinePoint)
{ {
QPointF p1, p2; QLineF circleLine (QPointF(), splinePoint-controlPoint);
VGObject::LineIntersectCircle(QPointF(), ScaledRadius(SceneScale(scene())), const qreal radius = ScaledRadius(SceneScale(scene()));
QLineF( QPointF(), splinePoint-controlPoint), p1, p2);
QLineF line(splinePoint-controlPoint, p1); if (circleLine.length() > radius)
controlLine->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false); {
controlLine->setLine(line); QPointF p1, p2;
controlLine->setVisible(not line.isNull()); VGObject::LineIntersectCircle(QPointF(), radius, circleLine, p1, p2);
controlLine->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); 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);
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------