diff options
Diffstat (limited to 'spline-widget/qfunctionconfigurator.cpp')
-rw-r--r-- | spline-widget/qfunctionconfigurator.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/spline-widget/qfunctionconfigurator.cpp b/spline-widget/qfunctionconfigurator.cpp index 112b5457..3df9fc9c 100644 --- a/spline-widget/qfunctionconfigurator.cpp +++ b/spline-widget/qfunctionconfigurator.cpp @@ -404,9 +404,8 @@ void QFunctionConfigurator::update_range() bool QFunctionConfigurator::point_within_pixel(const QPointF &pt, const QPointF &pixel) { - QPointF pixel2 = point_to_pixel(pt); - return pixel2.x() >= pixel.x() - pointSize && pixel2.x() < pixel.x() + pointSize && - pixel2.y() >= pixel.y() - pointSize && pixel2.y() < pixel.y() + pointSize; + QPointF tmp = pixel - point_to_pixel(pt); + return sqrt(QPointF::dotProduct(tmp, tmp)) < pointSize; } QPointF QFunctionConfigurator::pixel_coord_to_point(const QPointF& point) |