Подготовка к созданию Arc-объектов
This commit is contained in:
14
Canvas.cpp
14
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_ref;
|
||||
temp = line->start_ref;
|
||||
if (dist_P2P(p2, pos) <= tolerance)
|
||||
temp = line->p2_ref;
|
||||
temp = line->end_ref;
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
@@ -104,8 +104,8 @@ void Canvas::mousePressEvent(QMouseEvent* event)
|
||||
current_line->p1.y = y1;
|
||||
current_line->p2.x = x2;
|
||||
current_line->p2.y = y2;
|
||||
current_line->p1_ref = points[points.size() - 2];
|
||||
current_line->p2_ref = points[points.size() - 1];
|
||||
current_line->start_ref = points[points.size() - 2];
|
||||
current_line->end_ref = points[points.size() - 1];
|
||||
}
|
||||
else {
|
||||
*current_line->p2.x = scene.x();
|
||||
@@ -214,11 +214,11 @@ void Canvas::mousePressEvent(QMouseEvent* event)
|
||||
|
||||
Line *l1 = nullptr, *l2 = nullptr;
|
||||
for (Line* l : lines) {
|
||||
if (l->p1_ref == firstPoint || l->p2_ref == firstPoint) l1 = l;
|
||||
if (l->p1_ref == clickedPoint || l->p2_ref == clickedPoint) l2 = l;
|
||||
if (l->start_ref == firstPoint || l->end_ref == firstPoint) l1 = l;
|
||||
if (l->start_ref == clickedPoint || l->end_ref == clickedPoint) l2 = l;
|
||||
}
|
||||
|
||||
if (l1 == l2 ||
|
||||
if (l1 == l2 && l1 && l2 ||
|
||||
(areCoincident(firstPoint, clickedPoint, true)))
|
||||
{
|
||||
QMessageBox::warning(this, QString("NO!"), QString("P2P failed"));
|
||||
|
||||
Reference in New Issue
Block a user