diff --git a/ChangeLog.txt b/ChangeLog.txt
index a0dd3dde6..fb41c3207 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,4 +1,5 @@
# Version 0.5.0
+- [#366] Update 'Point from Distance and Angle' tool to read distance and angle between points.
- [#395] Create Curve tool which uses point as control handle.
- pdftops updated to version 3.04.
- [#306] Layout generator optimization. Divide into strips.
diff --git a/src/libs/vtools/dialogs/tools/dialogendline.cpp b/src/libs/vtools/dialogs/tools/dialogendline.cpp
index 55d278e94..e8bbd3346 100644
--- a/src/libs/vtools/dialogs/tools/dialogendline.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogendline.cpp
@@ -286,7 +286,7 @@ void DialogEndLine::ShowDialog(bool click)
QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
//Radius of point circle, but little bigger. Need handle with hover sizes.
- qreal radius = ToPixel(DefPointRadius/*mm*/, Unit::Mm)*1.5;
+ const qreal radius = ToPixel(DefPointRadius/*mm*/, Unit::Mm)*1.5;
if (line.length() <= radius)
{
return;
@@ -298,6 +298,7 @@ void DialogEndLine::ShowDialog(bool click)
SCASSERT(line != nullptr);
this->SetAngle(line->Angle());//Show in dialog angle what user choose
+ this->SetFormula(line->Length());
emit ToolTip("");
timerFormula->start();
this->show();
diff --git a/src/libs/vtools/visualization/vistoolendline.cpp b/src/libs/vtools/visualization/vistoolendline.cpp
index d7edbbc2c..5e5c7c01c 100644
--- a/src/libs/vtools/visualization/vistoolendline.cpp
+++ b/src/libs/vtools/visualization/vistoolendline.cpp
@@ -53,7 +53,15 @@ void VisToolEndLine::RefreshGeometry()
QLineF line;
if (qFuzzyIsNull(length))
{
- line = QLineF(first->toQPointF(), Ray(first->toQPointF()));
+ if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
+ {
+ line = QLineF(first->toQPointF(), Visualization::scenePos);
+ line.setAngle(CorrectAngle(line.angle()));
+ }
+ else
+ {
+ line = QLineF(first->toQPointF(), Visualization::scenePos);
+ }
}
else
{
@@ -61,8 +69,12 @@ void VisToolEndLine::RefreshGeometry()
DrawPoint(point, line.p2(), mainColor);
}
DrawLine(this, line, mainColor, lineStyle);
- Visualization::toolTip = QString(tr("Point at distance and angle: angle = %1°; Shift - "
- "sticking angle, Enter - finish creation")).arg(this->line().angle());
+ static const QString prefix = VDomDocument::UnitsToStr(qApp->patternUnit(), true);
+ Visualization::toolTip = QString(tr("Point at distance and angle: angle = %1°, length = %2%3; "
+ "Shift - sticking angle, Enter - finish creation"))
+ .arg(this->line().angle())
+ .arg(qApp->TrVars()->FormulaToUser(QString::number(qApp->fromPixel(this->line().length()))))
+ .arg(prefix);
}
//---------------------------------------------------------------------------------------------------------------------
@@ -77,6 +89,12 @@ void VisToolEndLine::SetAngle(const QString &expression)
angle = FindVal(expression, Visualization::data->PlainVariables());
}
+//---------------------------------------------------------------------------------------------------------------------
+QString VisToolEndLine::Length() const
+{
+ return QString::number(qApp->fromPixel(this->line().length()));
+}
+
//---------------------------------------------------------------------------------------------------------------------
void VisToolEndLine::setLength(const QString &expression)
{
diff --git a/src/libs/vtools/visualization/vistoolendline.h b/src/libs/vtools/visualization/vistoolendline.h
index ad4b0f58d..87e4b0bca 100644
--- a/src/libs/vtools/visualization/vistoolendline.h
+++ b/src/libs/vtools/visualization/vistoolendline.h
@@ -41,9 +41,13 @@ public:
virtual ~VisToolEndLine() Q_DECL_OVERRIDE;
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
+
QString Angle() const;
void SetAngle(const QString &expression);
+
+ QString Length() const;
void setLength(const QString &expression);
+
virtual int type() const Q_DECL_OVERRIDE {return Type;}
enum { Type = UserType + static_cast(Vis::ToolEndLine)};
private: