diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-10-28 08:31:04 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-10-28 08:31:12 +0200 |
commit | a3b890b9b4d8bc14c662cd0b3a3362e784b35593 (patch) | |
tree | 77e3b6141c66e7abc58eae87def3b3f5eec0ffb9 /spline-widget/spline-widget.cpp | |
parent | 8b56d691d7833bf6559503346384e227efd63175 (diff) |
spline-widget: use round, not trunc when converting pixel to val
Diffstat (limited to 'spline-widget/spline-widget.cpp')
-rw-r--r-- | spline-widget/spline-widget.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/spline-widget/spline-widget.cpp b/spline-widget/spline-widget.cpp index 975f26e5..e68ff4a6 100644 --- a/spline-widget/spline-widget.cpp +++ b/spline-widget/spline-widget.cpp @@ -543,14 +543,16 @@ QPointF spline_widget::pixel_coord_to_point(const QPoint& point) if (snap_x > 0) { + x += snap_x / 2.; x -= std::fmod(x, snap_x); - const volatile int x_ = int(x * c); + const volatile int x_ = iround(x * c); x = x_ / double(c); } if (snap_y > 0) { + y += snap_y / 2.; y -= std::fmod(y, snap_y); - const volatile int y_ = int(y * c); + const volatile int y_ = iround(y * c); y = y_ / double(c); } |