diff --git a/Canvas.cpp b/Canvas.cpp index cbfd5a0..fe7af21 100644 --- a/Canvas.cpp +++ b/Canvas.cpp @@ -34,9 +34,9 @@ Point* Canvas::findPointAt(QPointF pos, qreal tolerance) QPointF p2(*line->p2.x, *line->p2.y); if (dist_P2P(p1, pos) <= tolerance) - temp = &line->p1; + temp = line->p1_ref; else if (dist_P2P(p2, pos) <= tolerance) - temp = &line->p2; + temp = line->p2_ref; } return temp; } @@ -214,8 +214,8 @@ void Canvas::mousePressEvent(QMouseEvent* event) Line *l1 = nullptr, *l2 = nullptr; for (Line* l : lines) { - if (&l->p1 == firstPoint || &l->p2 == firstPoint) l1 = l; - if (&l->p1 == clickedPoint || &l->p2 == clickedPoint) l2 = l; + if (l->p1_ref == firstPoint || l->p2_ref == firstPoint) l1 = l; + if (l->p1_ref == clickedPoint || l->p2_ref == clickedPoint) l2 = l; } if (l1 == l2 ||