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());
//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;
}

View File

@ -316,7 +316,7 @@ void DialogEndLine::ShowDialog(bool click)
QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
//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;
}

View File

@ -236,7 +236,7 @@ void DialogLineIntersectAxis::ShowDialog(bool click)
QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
//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;
}

View File

@ -216,7 +216,7 @@ void DialogRotation::ShowDialog(bool click)
const QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
//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;
}

View File

@ -116,7 +116,7 @@ void VisToolRotation::RefreshGeometry()
DrawLine(xAxis, QLineF(static_cast<QPointF>(*origin), Ray(static_cast<QPointF>(*origin), 0)), supportColor2,
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);
Visualization::toolTip = tr("Rotating angle = %1°, <b>Shift</b> - sticking angle, "

View File

@ -86,7 +86,7 @@ VisToolSpline::~VisToolSpline()
void VisToolSpline::RefreshGeometry()
{
//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)
{

View File

@ -213,7 +213,7 @@ void VisToolSplinePath::Creating(const QPointF &pSpl, int size)
if (not ctrlPoints[lastPoint]->isVisible())
{
//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)
{

View File

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

View File

@ -33,7 +33,7 @@
#include <QGraphicsScene>
#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 widthHairLine = widthMainLine/3.0;

View File

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