Don't show control points if too close to start and end points.
--HG-- branch : feature
This commit is contained in:
parent
6dd26ddd73
commit
1924b30f6f
|
@ -73,6 +73,9 @@ VisToolSpline::~VisToolSpline()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolSpline::RefreshGeometry()
|
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)
|
if (object1Id > NULL_ID)
|
||||||
{
|
{
|
||||||
const auto first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
const auto first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||||
|
@ -84,8 +87,15 @@ void VisToolSpline::RefreshGeometry()
|
||||||
{
|
{
|
||||||
p2 = Visualization::scenePos;
|
p2 = Visualization::scenePos;
|
||||||
controlPoints[0]->RefreshCtrlPoint(1, SplinePointPosition::FirstPoint, p2, first->toQPointF());
|
controlPoints[0]->RefreshCtrlPoint(1, SplinePointPosition::FirstPoint, p2, first->toQPointF());
|
||||||
|
|
||||||
|
if (not controlPoints[0]->isVisible())
|
||||||
|
{
|
||||||
|
if (QLineF(first->toQPointF(), p2).length() > radius)
|
||||||
|
{
|
||||||
controlPoints[0]->show();
|
controlPoints[0]->show();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p2Selected = true;
|
p2Selected = true;
|
||||||
|
@ -109,10 +119,16 @@ void VisToolSpline::RefreshGeometry()
|
||||||
QLineF ctrlLine (second->toQPointF(), Visualization::scenePos);
|
QLineF ctrlLine (second->toQPointF(), Visualization::scenePos);
|
||||||
ctrlLine.setAngle(ctrlLine.angle()+180);
|
ctrlLine.setAngle(ctrlLine.angle()+180);
|
||||||
p3 = ctrlLine.p2();
|
p3 = ctrlLine.p2();
|
||||||
|
|
||||||
controlPoints[1]->RefreshCtrlPoint(1, SplinePointPosition::LastPoint, p3, second->toQPointF());
|
controlPoints[1]->RefreshCtrlPoint(1, SplinePointPosition::LastPoint, p3, second->toQPointF());
|
||||||
|
|
||||||
|
if (not controlPoints[1]->isVisible())
|
||||||
|
{
|
||||||
|
if (QLineF(second->toQPointF(), p3).length() > radius)
|
||||||
|
{
|
||||||
controlPoints[1]->show();
|
controlPoints[1]->show();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p3Selected = true;
|
p3Selected = true;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user