get_closest_point: Prefer earlier points

Only switch to a later point if it is strictly
closer than the existing match. This fixes
start- vs endpoint confusion in the rectangle
tests.
This commit is contained in:
Matthias Clasen
2023-08-09 15:06:58 -04:00
parent 917307a6a4
commit 6220baf230

View File

@@ -451,7 +451,8 @@ gsk_standard_contour_get_closest_point (const GskContour *contour,
continue; continue;
gsk_curve_init (&c, self->ops[i]); gsk_curve_init (&c, self->ops[i]);
if (gsk_curve_get_closest_point (&c, point, threshold, &distance, &t)) if (gsk_curve_get_closest_point (&c, point, threshold, &distance, &t) &&
distance < threshold)
{ {
best_idx = i; best_idx = i;
best_t = t; best_t = t;