Применение point_ref
This commit is contained in:
@@ -34,9 +34,9 @@ Point* Canvas::findPointAt(QPointF pos, qreal tolerance)
|
|||||||
QPointF p2(*line->p2.x, *line->p2.y);
|
QPointF p2(*line->p2.x, *line->p2.y);
|
||||||
|
|
||||||
if (dist_P2P(p1, pos) <= tolerance)
|
if (dist_P2P(p1, pos) <= tolerance)
|
||||||
temp = &line->p1;
|
temp = line->p1_ref;
|
||||||
else if (dist_P2P(p2, pos) <= tolerance)
|
else if (dist_P2P(p2, pos) <= tolerance)
|
||||||
temp = &line->p2;
|
temp = line->p2_ref;
|
||||||
}
|
}
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
@@ -214,8 +214,8 @@ void Canvas::mousePressEvent(QMouseEvent* event)
|
|||||||
|
|
||||||
Line *l1 = nullptr, *l2 = nullptr;
|
Line *l1 = nullptr, *l2 = nullptr;
|
||||||
for (Line* l : lines) {
|
for (Line* l : lines) {
|
||||||
if (&l->p1 == firstPoint || &l->p2 == firstPoint) l1 = l;
|
if (l->p1_ref == firstPoint || l->p2_ref == firstPoint) l1 = l;
|
||||||
if (&l->p1 == clickedPoint || &l->p2 == clickedPoint) l2 = l;
|
if (l->p1_ref == clickedPoint || l->p2_ref == clickedPoint) l2 = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l1 == l2 ||
|
if (l1 == l2 ||
|
||||||
|
|||||||
Reference in New Issue
Block a user