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