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

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