From bd472d4bd75926cbf90ccddea63aa0b36294860f Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Fri, 18 Apr 2025 18:28:53 +0200 Subject: Manual stitch ripples: connector line stitch length (#3661) --- lib/stitches/ripple_stitch.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/stitches/ripple_stitch.py b/lib/stitches/ripple_stitch.py index b1179bf7..7a2783f7 100644 --- a/lib/stitches/ripple_stitch.py +++ b/lib/stitches/ripple_stitch.py @@ -49,15 +49,19 @@ def ripple_stitch(stroke): def _get_stitches(stroke, is_linear, lines, skip_start): if stroke.manual_pattern_placement: - if stroke.flip_copies: - stitches = [] - for i, line in enumerate(lines): - if i % 2 == 0: - stitches.extend(line[::-1]) - else: - stitches.extend(line) - return stitches - return [point for line in lines for point in line] + stitches = [] + for i, line in enumerate(lines): + if i % 2 == 0 and stroke.flip_copies: + line = line[::-1] + if stitches: + # even though this is manual stitch placement, we do not want the + # connector lines to exceed the running stitch length value + # so let's add some points + points = LineString([stitches[-1], line[0]]).segmentize(stroke.running_stitch_length).coords + if len(points) > 2: + stitches.extend([InkstitchPoint(coord[0], coord[1]) for coord in points[1:-1]]) + stitches.extend(line) + return stitches if is_linear and stroke.flip_copies: return _get_staggered_stitches(stroke, lines, skip_start) else: -- cgit v1.2.3