summaryrefslogtreecommitdiffhomepage
path: root/spline-widget
diff options
context:
space:
mode:
Diffstat (limited to 'spline-widget')
-rw-r--r--spline-widget/spline-widget.cpp6
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);
}