Fix bug in control point.
Do not draw control point in constructor. It creates artefacts if they enabled from start. --HG-- branch : develop
This commit is contained in:
parent
89d01f3fe5
commit
575068e181
|
@ -105,18 +105,14 @@ VToolSpline::VToolSpline(VToolSplineInitData initData, QGraphicsItem *parent)
|
||||||
const bool freeLength1 = qmu::QmuTokenParser::IsSingle(spl->GetC1LengthFormula());
|
const bool freeLength1 = qmu::QmuTokenParser::IsSingle(spl->GetC1LengthFormula());
|
||||||
|
|
||||||
auto *controlPoint1 = new VControlPointSpline(1, SplinePointPosition::FirstPoint,
|
auto *controlPoint1 = new VControlPointSpline(1, SplinePointPosition::FirstPoint,
|
||||||
static_cast<QPointF>(spl->GetP2()),
|
static_cast<QPointF>(spl->GetP2()), freeAngle1, freeLength1, this);
|
||||||
static_cast<QPointF>(spl->GetP1()),
|
|
||||||
freeAngle1, freeLength1, this);
|
|
||||||
InitControlPoint(controlPoint1);
|
InitControlPoint(controlPoint1);
|
||||||
|
|
||||||
const bool freeAngle2 = qmu::QmuTokenParser::IsSingle(spl->GetEndAngleFormula());
|
const bool freeAngle2 = qmu::QmuTokenParser::IsSingle(spl->GetEndAngleFormula());
|
||||||
const bool freeLength2 = qmu::QmuTokenParser::IsSingle(spl->GetC2LengthFormula());
|
const bool freeLength2 = qmu::QmuTokenParser::IsSingle(spl->GetC2LengthFormula());
|
||||||
|
|
||||||
auto *controlPoint2 = new VControlPointSpline(1, SplinePointPosition::LastPoint,
|
auto *controlPoint2 = new VControlPointSpline(1, SplinePointPosition::LastPoint,
|
||||||
static_cast<QPointF>(spl->GetP3()),
|
static_cast<QPointF>(spl->GetP3()), freeAngle2, freeLength2, this);
|
||||||
static_cast<QPointF>(spl->GetP4()),
|
|
||||||
freeAngle2, freeLength2, this);
|
|
||||||
InitControlPoint(controlPoint2);
|
InitControlPoint(controlPoint2);
|
||||||
|
|
||||||
ShowHandles(detailsMode);
|
ShowHandles(detailsMode);
|
||||||
|
|
|
@ -115,16 +115,14 @@ VToolSplinePath::VToolSplinePath(const VToolSplinePathInitData &initData, QGraph
|
||||||
const bool freeLength1 = qmu::QmuTokenParser::IsSingle(spl.GetC1LengthFormula());
|
const bool freeLength1 = qmu::QmuTokenParser::IsSingle(spl.GetC1LengthFormula());
|
||||||
|
|
||||||
auto *controlPoint = new VControlPointSpline(i, SplinePointPosition::FirstPoint,
|
auto *controlPoint = new VControlPointSpline(i, SplinePointPosition::FirstPoint,
|
||||||
static_cast<QPointF>(spl.GetP2()),
|
static_cast<QPointF>(spl.GetP2()), freeAngle1, freeLength1, this);
|
||||||
static_cast<QPointF>(spl.GetP1()),
|
|
||||||
freeAngle1, freeLength1, this);
|
|
||||||
InitControlPoint(controlPoint);
|
InitControlPoint(controlPoint);
|
||||||
|
|
||||||
const bool freeAngle2 = qmu::QmuTokenParser::IsSingle(spl.GetEndAngleFormula());
|
const bool freeAngle2 = qmu::QmuTokenParser::IsSingle(spl.GetEndAngleFormula());
|
||||||
const bool freeLength2 = qmu::QmuTokenParser::IsSingle(spl.GetC2LengthFormula());
|
const bool freeLength2 = qmu::QmuTokenParser::IsSingle(spl.GetC2LengthFormula());
|
||||||
|
|
||||||
controlPoint = new VControlPointSpline(i, SplinePointPosition::LastPoint, static_cast<QPointF>(spl.GetP3()),
|
controlPoint = new VControlPointSpline(i, SplinePointPosition::LastPoint, static_cast<QPointF>(spl.GetP3()),
|
||||||
static_cast<QPointF>(spl.GetP4()), freeAngle2, freeLength2, this);
|
freeAngle2, freeLength2, this);
|
||||||
InitControlPoint(controlPoint);
|
InitControlPoint(controlPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePointP
|
||||||
freeLength(true)
|
freeLength(true)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
|
setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -73,7 +74,7 @@ VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePointP
|
||||||
* @param parent parent object.
|
* @param parent parent object.
|
||||||
*/
|
*/
|
||||||
VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePointPosition position,
|
VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePointPosition position,
|
||||||
const QPointF &controlPoint, const QPointF &splinePoint, bool freeAngle,
|
const QPointF &controlPoint, bool freeAngle,
|
||||||
bool freeLength, QGraphicsItem *parent)
|
bool freeLength, QGraphicsItem *parent)
|
||||||
: VScenePoint(parent),
|
: VScenePoint(parent),
|
||||||
controlLine(nullptr),
|
controlLine(nullptr),
|
||||||
|
@ -88,8 +89,9 @@ VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePointP
|
||||||
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||||
this->setAcceptHoverEvents(true);
|
this->setAcceptHoverEvents(true);
|
||||||
this->setPos(controlPoint);
|
this->setPos(controlPoint);
|
||||||
|
setVisible(false);
|
||||||
|
|
||||||
SetCtrlLine(controlPoint, splinePoint);
|
// Do not draw control point in constructor. It creates artefacts if they enabled from start.
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -52,7 +52,7 @@ class VControlPointSpline : public QObject, public VScenePoint
|
||||||
public:
|
public:
|
||||||
VControlPointSpline(const qint32 &indexSpline, SplinePointPosition position, QGraphicsItem * parent = nullptr);
|
VControlPointSpline(const qint32 &indexSpline, SplinePointPosition position, QGraphicsItem * parent = nullptr);
|
||||||
VControlPointSpline(const qint32 &indexSpline, SplinePointPosition position, const QPointF &controlPoint,
|
VControlPointSpline(const qint32 &indexSpline, SplinePointPosition position, const QPointF &controlPoint,
|
||||||
const QPointF &splinePoint, bool freeAngle, bool freeLength, QGraphicsItem * parent = nullptr);
|
bool freeAngle, bool freeLength, QGraphicsItem * parent = nullptr);
|
||||||
virtual ~VControlPointSpline() =default;
|
virtual ~VControlPointSpline() =default;
|
||||||
|
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user