From 1924b30f6f57231857a8953a780378d7a91ee1e7 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 12 Feb 2016 20:32:31 +0200 Subject: [PATCH] Don't show control points if too close to start and end points. --HG-- branch : feature --- .../vtools/visualization/vistoolspline.cpp | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/libs/vtools/visualization/vistoolspline.cpp b/src/libs/vtools/visualization/vistoolspline.cpp index 91ebe9da6..6f276e644 100644 --- a/src/libs/vtools/visualization/vistoolspline.cpp +++ b/src/libs/vtools/visualization/vistoolspline.cpp @@ -73,6 +73,9 @@ VisToolSpline::~VisToolSpline() //--------------------------------------------------------------------------------------------------------------------- void VisToolSpline::RefreshGeometry() { + //Radius of point circle, but little bigger. Need handle with hover sizes. + const static qreal radius = ToPixel(DefPointRadius/*mm*/, Unit::Mm)*1.5; + if (object1Id > NULL_ID) { const auto first = Visualization::data->GeometricObject(object1Id); @@ -84,7 +87,14 @@ void VisToolSpline::RefreshGeometry() { p2 = Visualization::scenePos; controlPoints[0]->RefreshCtrlPoint(1, SplinePointPosition::FirstPoint, p2, first->toQPointF()); - controlPoints[0]->show(); + + if (not controlPoints[0]->isVisible()) + { + if (QLineF(first->toQPointF(), p2).length() > radius) + { + controlPoints[0]->show(); + } + } } else { @@ -109,9 +119,15 @@ void VisToolSpline::RefreshGeometry() QLineF ctrlLine (second->toQPointF(), Visualization::scenePos); ctrlLine.setAngle(ctrlLine.angle()+180); p3 = ctrlLine.p2(); - controlPoints[1]->RefreshCtrlPoint(1, SplinePointPosition::LastPoint, p3, second->toQPointF()); - controlPoints[1]->show(); + + if (not controlPoints[1]->isVisible()) + { + if (QLineF(second->toQPointF(), p3).length() > radius) + { + controlPoints[1]->show(); + } + } } else {