Resolved issue #461. Improve feature: Add a keyboard shortcut for getting pure 45, 90, 135, 180, 225, 270, 315 and 0 degree angles for all tools.
--HG-- branch : feature
This commit is contained in:
parent
14afb2ce9b
commit
01f66d3c34
|
@ -261,6 +261,10 @@ VSpline VAbstractSpline::CorrectedSpline(const VSpline &spline, const SplinePoin
|
|||
if (position == SplinePointPosition::FirstPoint)
|
||||
{
|
||||
QLineF line(spline.GetP1(), pos);
|
||||
if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
|
||||
{
|
||||
line.setAngle(VisLine::CorrectAngle(line.angle()));
|
||||
}
|
||||
|
||||
qreal newAngle1 = line.angle();
|
||||
QString newAngle1F = QString().setNum(newAngle1);
|
||||
|
@ -287,6 +291,10 @@ VSpline VAbstractSpline::CorrectedSpline(const VSpline &spline, const SplinePoin
|
|||
else
|
||||
{
|
||||
QLineF line(spline.GetP4(), pos);
|
||||
if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
|
||||
{
|
||||
line.setAngle(VisLine::CorrectAngle(line.angle()));
|
||||
}
|
||||
|
||||
qreal newAngle2 = line.angle();
|
||||
QString newAngle2F = QString().setNum(newAngle2);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#define VABSTRACTSPLINE_H
|
||||
|
||||
#include "../vdrawtool.h"
|
||||
#include "visualization/line/visline.h"
|
||||
|
||||
#include <QGraphicsPathItem>
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ VisLine::~VisLine()
|
|||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VisLine::CorrectAngle(const qreal &angle) const
|
||||
qreal VisLine::CorrectAngle(const qreal &angle)
|
||||
{
|
||||
qreal ang = angle;
|
||||
if (angle > 360)
|
||||
|
|
|
@ -44,8 +44,8 @@ public:
|
|||
|
||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Vis::Line)};
|
||||
static qreal CorrectAngle(const qreal &angle);
|
||||
protected:
|
||||
qreal CorrectAngle(const qreal &angle) const;
|
||||
QPointF Ray(const QPointF &firstPoint, const qreal &angle) const;
|
||||
QPointF Ray(const QPointF &firstPoint) const;
|
||||
QLineF Axis(const QPointF &p, const qreal &angle) const;
|
||||
|
|
Loading…
Reference in New Issue
Block a user