If point intersects with rect the line to the label wrong.

--HG--
branch : develop
This commit is contained in:
dismine 2014-08-17 22:34:01 +03:00
parent fcffc03649
commit aec154e43c

View File

@ -241,27 +241,37 @@ void VToolPoint::RefreshPointGeometry(const VPointF &point)
*/ */
void VToolPoint::RefreshLine() void VToolPoint::RefreshLine()
{ {
QRectF nameRec = namePoint->sceneBoundingRect(); QRectF nRec = namePoint->sceneBoundingRect();
QPointF p1, p2; nRec.translate(- scenePos());
LineIntersectCircle(QPointF(), radius/factor, QLineF(QPointF(), nameRec.center()- scenePos()), p1, p2); if (this->rect().intersects(nRec) == false)
QPointF pRec = LineIntersectRect(nameRec, QLineF(scenePos(), nameRec.center()));
lineName->setLine(QLineF(p1, pRec - scenePos()));
if (currentColor == Qt::gray)
{ {
lineName->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); QRectF nameRec = namePoint->sceneBoundingRect();
QPointF p1, p2;
LineIntersectCircle(QPointF(), radius/factor, QLineF(QPointF(), nameRec.center() - scenePos()), p1, p2);
QPointF pRec = LineIntersectRect(nameRec, QLineF(scenePos(), nameRec.center()));
lineName->setLine(QLineF(p1, pRec - scenePos()));
if (currentColor == Qt::gray)
{
lineName->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
}
else
{
lineName->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine())/factor));
}
if (QLineF(p1, pRec - scenePos()).length() <= qApp->toPixel(4, Unit::Mm))
{
lineName->setVisible(false);
}
else
{
lineName->setVisible(true);
}
} }
else else
{
lineName->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine())/factor));
}
if (QLineF(p1, pRec - scenePos()).length() <= qApp->toPixel(4, Unit::Mm))
{ {
lineName->setVisible(false); lineName->setVisible(false);
} }
else
{
lineName->setVisible(true);
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------