Commit 2d11d291 authored by Ell's avatar Ell

app: improve GimpToolLine slider motion clamping/constraint

During constrained motion, round the slider value before clamping
it, so that the slider limits are always enforced.  Additionally,
snap the slider to 1/12-ths of the line length, rather than
1/24-ths.

Make sure that sliders can never have negative-zero values, which
can result in a -inf base for spiral.
parent 42f0db19
......@@ -733,11 +733,13 @@ gimp_tool_line_point_motion (GimpToolLine *line,
(private->y2 - private->y1) * (y - private->y1);
t /= length_sqr;
if (constrain)
t = RINT (12.0 * t) / 12.0;
t = CLAMP (t, slider->min, slider->max);
t = CLAMP (t, 0.0, 1.0);
if (constrain)
t = RINT (24.0 * t) / 24.0;
t = fabs (t); /* avoid negative zero */
slider->value = t;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment