diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2025-04-18 18:28:53 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-18 18:28:53 +0200 |
| commit | bd472d4bd75926cbf90ccddea63aa0b36294860f (patch) | |
| tree | a74a5c762da0d0fceadc070633f2424f66b8d37d | |
| parent | 571a61a2c2465c5e77c6bcc4dcb2ae7119af399c (diff) | |
Manual stitch ripples: connector line stitch length (#3661)
| -rw-r--r-- | lib/stitches/ripple_stitch.py | 22 |
1 files 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: |
