diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-11-26 09:26:58 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-11-29 11:58:45 +0100 |
commit | fdf6585e61e7e76abee0ddf5bd02db79885d42ec (patch) | |
tree | ec20651806a4baa7076bae07d5f8144809e723a8 /spline-widget | |
parent | 946330846e7a33fc5357a91f4d2a7ef9bea6af02 (diff) |
qfc: use euclidean distance to point
Don't use rectangle bounding box for circles
Diffstat (limited to 'spline-widget')
-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) |