diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2009-04-27 16:51:16 -0400 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2009-04-27 16:51:16 -0400 |
| commit | 3bfcc7c8d54ae6b1d8146a6ebb3f93f9a0b300c6 (patch) | |
| tree | 138a3ef9226611528848eb5b31c60dc823bfbba0 | |
| parent | 83113d6199503d7e1046a09d0071c9344a4130b2 (diff) | |
Determine whether the point is between better
| -rw-r--r-- | sigmodr/widgets/mapeditor/WorldMapPlacement.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp b/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp index 79972ecb..93a6ba45 100644 --- a/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp +++ b/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp @@ -308,12 +308,12 @@ QPoint WorldMapPlacement::find(const QPoint& point) const QPoint cur = polygon[i]; const QPoint next = polygon[(i + 1) % polygon.size()]; QRectF rect(QPoint(), m_size); - if (((point.x() - last.x()) * (point.x() - cur.x())) < 0) + if (between(point.x(), cur.x(), last.x())) { rect.moveCenter(QPoint(point.x(), cur.y() + ((((point.y() < cur.y()) ? 1 : -1) * m_size.height()) / 2))); best = closer(best, rect.toRect(), point); } - else if (((point.y() - last.y()) * (point.y() - cur.y())) < 0) + else if (between(point.y(), cur.y(), last.y())) { rect.moveCenter(QPoint(cur.x() + ((((point.x() < cur.x()) ? 1 : -1) * m_size.width()) / 2), point.y())); best = closer(best, rect.toRect(), point); |
