Commit d22d364d authored by Henrik Brix Andersen's avatar Henrik Brix Andersen Committed by Henrik Brix Andersen
Browse files

Finally fixed bug #125864:

2004-01-17 Henrik Brix Andersen <brix@gimp.org>

Finally fixed bug #125864:

* app/core/gimpimage-guides.c (gimp_image_find_guide): iterate
over the entire list of guides to determine the closest one.

* app/core/gimpimage-snap.c: use gdoubles instead of gints for
dist and mindist variables to make sure grid and guides with 1px
spacings work as expected.
parent 07a7788f
2004-01-17 Henrik Brix Andersen <brix@gimp.org>
Finally fixed bug #125864:
* app/core/gimpimage-guides.c (gimp_image_find_guide): iterate
over the entire list of guides to determine the closest one.
* app/core/gimpimage-snap.c: use gdoubles instead of gints for
dist and mindist variables to make sure grid and guides with 1px
spacings work as expected.
2004-01-17 Sven Neumann <sven@gimp.org>
 
* libgimpthumb/gimpthumbnail.c: added more optional debug output
......@@ -181,6 +181,9 @@ gimp_image_find_guide (GimpImage *gimage,
{
GList *list;
GimpGuide *guide;
GimpGuide *ret = NULL;
gdouble dist;
gdouble mindist = G_MAXDOUBLE;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
......@@ -200,19 +203,23 @@ gimp_image_find_guide (GimpImage *gimage,
switch (guide->orientation)
{
case GIMP_ORIENTATION_HORIZONTAL:
if (ABS (guide->position - y) < GUIDE_EPSILON)
return guide;
dist = ABS (guide->position - y);
break;
case GIMP_ORIENTATION_VERTICAL:
if (ABS (guide->position - x) < GUIDE_EPSILON)
return guide;
dist = ABS (guide->position - x);
break;
default:
break;
continue;
}
if (dist < MIN (GUIDE_EPSILON, mindist))
{
mindist = dist;
ret = guide;
}
}
return NULL;
return ret;
}
......@@ -49,9 +49,9 @@ gimp_image_snap_x (GimpImage *gimage,
GimpGrid *grid;
gdouble xspacing;
gdouble xoffset;
gint mindist = G_MAXINT;
gint dist;
gint i;
gdouble mindist = G_MAXDOUBLE;
gdouble dist;
gdouble i;
gboolean snapped = FALSE;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
......@@ -102,7 +102,7 @@ gimp_image_snap_x (GimpImage *gimage,
if (i < 0)
continue;
dist = ABS (i - x - 0.5);
dist = ABS (i - x);
if (dist < MIN (EPSILON, mindist))
{
......@@ -128,9 +128,9 @@ gimp_image_snap_y (GimpImage *gimage,
GimpGrid *grid;
gdouble yspacing;
gdouble yoffset;
gint mindist = G_MAXINT;
gint dist;
gint i;
gdouble mindist = G_MAXDOUBLE;
gdouble dist;
gdouble i;
gboolean snapped = FALSE;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
......@@ -181,7 +181,7 @@ gimp_image_snap_y (GimpImage *gimage,
if (i < 0)
continue;
dist = ABS (i - y - 0.5);
dist = ABS (i - y);
if (dist < MIN (EPSILON, mindist))
{
......@@ -209,9 +209,9 @@ gimp_image_snap_point (GimpImage *gimage,
GimpGrid *grid;
gdouble xspacing, yspacing;
gdouble xoffset, yoffset;
gint minxdist, minydist;
gint dist;
gint i;
gdouble minxdist, minydist;
gdouble dist;
gdouble i;
gboolean snapped = FALSE;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
......@@ -288,7 +288,7 @@ gimp_image_snap_point (GimpImage *gimage,
if (i < 0)
continue;
dist = ABS (i - x - 0.5);
dist = ABS (i - x);
if (dist < MIN (EPSILON, minxdist))
{
......@@ -303,7 +303,7 @@ gimp_image_snap_point (GimpImage *gimage,
if (i < 0)
continue;
dist = ABS (i - y - 0.5);
dist = ABS (i - y);
if (dist < MIN (EPSILON, minydist))
{
......
Supports Markdown
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