Fix Canvas and P2P

This commit is contained in:
2025-12-10 21:35:27 +03:00
parent ef526d66ce
commit d8f935a90b

View File

@@ -53,7 +53,7 @@ bool Canvas::areCoincident(Point* p1, Point* p2)
bool isSamePair = (pair_tag_0 == tag_0 && pair_tag_1 == tag_1) ||
(pair_tag_0 == tag_1 && pair_tag_1 == tag_0);
if (isSamePair) return true;
if (isSamePair && *p1 == *p2) return true;
}
return false;
}
@@ -228,7 +228,7 @@ void Canvas::mousePressEvent(QMouseEvent* event)
}
if (l1 == l2 && l1 && l2 ||
(areCoincident(firstPoint, clickedPoint, true)))
(areCoincident(firstPoint, clickedPoint)))
{
QMessageBox::warning(this, QString("NO!"), QString("P2P failed"));
firstPoint = nullptr;
@@ -251,7 +251,7 @@ void Canvas::mouseMoveEvent(QMouseEvent* event)
if (draggedPoint) {
QPointF pos = event->pos() - dragOffset;
for (Point* pair : points) {
if (areCoincident(draggedPoint, pair, true)) {
if (areCoincident(draggedPoint, pair)) {
*pair->x = pos.x();
*pair->y = pos.y();
}