[gimp] app: improve GimpToolLine slider motion clamping/constraint
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: improve GimpToolLine slider motion clamping/constraint
- Date: Sun, 30 Jul 2017 18:03:21 +0000 (UTC)
commit 2d11d29157086417c0106175c73eb0045b73f1c8
Author: Ell <ell_se yahoo com>
Date: Sun Jul 30 13:49:21 2017 -0400
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.
app/display/gimptoolline.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/app/display/gimptoolline.c b/app/display/gimptoolline.c
index 36596b2..a957646 100644
--- a/app/display/gimptoolline.c
+++ b/app/display/gimptoolline.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]