From 06c591326a2c545484004b58a41c4b7b60c35525 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 5 Sep 2016 17:14:38 +0200 Subject: spline-widget: fix rounding for short splines This was especially visible with XYZ spline widgets. --- spline-widget/spline.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'spline-widget') diff --git a/spline-widget/spline.cpp b/spline-widget/spline.cpp index 7d0c8412..9f0f2dec 100644 --- a/spline-widget/spline.cpp +++ b/spline-widget/spline.cpp @@ -391,13 +391,13 @@ mem spline::get_settings() const return s; } -int spline::precision(const QList& points) const +double spline::precision(const QList& points) const { // this adjusts the memoized range to the largest X value. empty space doesn't take value_count discrete points. if (points.size()) - return clamp(value_count / clamp(int(points[points.size() - 1].x()), 1, int(max_x)), 0, value_count); + return clamp(value_count / clamp(points[points.size() - 1].x(), 1., max_x), 0., double(value_count)); - return value_count / clamp(int(max_x), 1, value_count); + return value_count / clamp(max_x, 1., double(value_count)); } namespace spline_detail { -- cgit v1.2.3