Fix scale problem with selecting points.

We scaled point circle size, but forgot to adjust test size according to scale
too.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-10-19 15:56:57 +03:00
parent 3e80b6439a
commit 52a8fb5bae
10 changed files with 9 additions and 11 deletions

View file

@ -206,7 +206,7 @@ void DialogCurveIntersectAxis::ShowDialog(bool click)
QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos()); QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
//Radius of point circle, but little bigger. Need handle with hover sizes. //Radius of point circle, but little bigger. Need handle with hover sizes.
if (line.length() <= defPointRadiusPixel*1.5) if (line.length() <= ScaledRadius(SceneScale(qApp->getCurrentScene()))*1.5)
{ {
return; return;
} }

View file

@ -316,7 +316,7 @@ void DialogEndLine::ShowDialog(bool click)
QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos()); QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
//Radius of point circle, but little bigger. Need handle with hover sizes. //Radius of point circle, but little bigger. Need handle with hover sizes.
if (line.length() <= defPointRadiusPixel*1.5) if (line.length() <= ScaledRadius(SceneScale(qApp->getCurrentScene()))*1.5)
{ {
return; return;
} }

View file

@ -236,7 +236,7 @@ void DialogLineIntersectAxis::ShowDialog(bool click)
QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos()); QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
//Radius of point circle, but little bigger. Need handle with hover sizes. //Radius of point circle, but little bigger. Need handle with hover sizes.
if (line.length() <= defPointRadiusPixel*1.5) if (line.length() <= ScaledRadius(SceneScale(qApp->getCurrentScene()))*1.5)
{ {
return; return;
} }

View file

@ -216,7 +216,7 @@ void DialogRotation::ShowDialog(bool click)
const QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos()); const QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
//Radius of point circle, but little bigger. Need handle with hover sizes. //Radius of point circle, but little bigger. Need handle with hover sizes.
if (line.length() <= defPointRadiusPixel*1.5) if (line.length() <= ScaledRadius(SceneScale(qApp->getCurrentScene()))*1.5)
{ {
return; return;
} }

View file

@ -116,7 +116,7 @@ void VisToolRotation::RefreshGeometry()
DrawLine(xAxis, QLineF(static_cast<QPointF>(*origin), Ray(static_cast<QPointF>(*origin), 0)), supportColor2, DrawLine(xAxis, QLineF(static_cast<QPointF>(*origin), Ray(static_cast<QPointF>(*origin), 0)), supportColor2,
Qt::DashLine); Qt::DashLine);
VArc arc(*origin, defPointRadiusPixel*2, 0, tempAngle); VArc arc(*origin, ScaledRadius(SceneScale(qApp->getCurrentScene()))*2, 0, tempAngle);
DrawPath(angleArc, arc.GetPath(), supportColor2, Qt::SolidLine, Qt::RoundCap); DrawPath(angleArc, arc.GetPath(), supportColor2, Qt::SolidLine, Qt::RoundCap);
Visualization::toolTip = tr("Rotating angle = %1°, <b>Shift</b> - sticking angle, " Visualization::toolTip = tr("Rotating angle = %1°, <b>Shift</b> - sticking angle, "

View file

@ -86,7 +86,7 @@ VisToolSpline::~VisToolSpline()
void VisToolSpline::RefreshGeometry() void VisToolSpline::RefreshGeometry()
{ {
//Radius of point circle, but little bigger. Need handle with hover sizes. //Radius of point circle, but little bigger. Need handle with hover sizes.
const static qreal radius = defPointRadiusPixel*1.5; const static qreal radius = ScaledRadius(SceneScale(qApp->getCurrentScene()))*1.5;
if (object1Id > NULL_ID) if (object1Id > NULL_ID)
{ {

View file

@ -213,7 +213,7 @@ void VisToolSplinePath::Creating(const QPointF &pSpl, int size)
if (not ctrlPoints[lastPoint]->isVisible()) if (not ctrlPoints[lastPoint]->isVisible())
{ {
//Radius of point circle, but little bigger. Need handle with hover sizes. //Radius of point circle, but little bigger. Need handle with hover sizes.
if (QLineF(pSpl, ctrlPoint).length() > defPointRadiusPixel*1.5) if (QLineF(pSpl, ctrlPoint).length() > ScaledRadius(SceneScale(qApp->getCurrentScene()))*1.5)
{ {
if (size == 1) if (size == 1)
{ {

View file

@ -255,7 +255,6 @@ VScaledEllipse *Visualization::GetPointItem(QVector<VScaledEllipse *> &points, q
points.append(point); points.append(point);
return point; return point;
} }
return nullptr;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -269,7 +268,7 @@ VScaledEllipse *Visualization::InitPointItem(const QColor &color, QGraphicsItem
visPen.setColor(color); visPen.setColor(color);
point->setPen(visPen); point->setPen(visPen);
point->setRect(PointRect(defPointRadiusPixel)); point->setRect(PointRect(ScaledRadius(SceneScale(qApp->getCurrentScene()))));
point->setPos(QPointF()); point->setPos(QPointF());
point->setFlags(QGraphicsItem::ItemStacksBehindParent); point->setFlags(QGraphicsItem::ItemStacksBehindParent);
point->setZValue(z); point->setZValue(z);

View file

@ -33,7 +33,7 @@
#include <QGraphicsScene> #include <QGraphicsScene>
#include <QGraphicsView> #include <QGraphicsView>
const qreal defPointRadiusPixel = (2./*mm*/ / 25.4) * PrintDPI; static const qreal defPointRadiusPixel = (2./*mm*/ / 25.4) * PrintDPI;
const qreal widthMainLine = (1.2/*mm*/ / 25.4) * PrintDPI; const qreal widthMainLine = (1.2/*mm*/ / 25.4) * PrintDPI;
const qreal widthHairLine = widthMainLine/3.0; const qreal widthHairLine = widthMainLine/3.0;

View file

@ -31,7 +31,6 @@
#include <QtGlobal> #include <QtGlobal>
extern const qreal defPointRadiusPixel;
extern const qreal widthMainLine; extern const qreal widthMainLine;
extern const qreal widthHairLine; extern const qreal widthHairLine;