summaryrefslogtreecommitdiff
path: root/lib/elements/fill_stitch.py
diff options
context:
space:
mode:
authorLex Neva <lexelby@users.noreply.github.com>2024-06-20 10:45:53 -0700
committerGitHub <noreply@github.com>2024-06-20 19:45:53 +0200
commite8017e0bcc0be2ef128bcea187f6528ed0a3d197 (patch)
tree8196bb69d5ce4fee839056f24abe181fd773afb3 /lib/elements/fill_stitch.py
parentc017cae01aa33a876795ec5da1438e8ec0f11fc5 (diff)
auto-fill pull compensation (#2891)
Diffstat (limited to 'lib/elements/fill_stitch.py')
-rw-r--r--lib/elements/fill_stitch.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/elements/fill_stitch.py b/lib/elements/fill_stitch.py
index 188c2ad7..c539cf7e 100644
--- a/lib/elements/fill_stitch.py
+++ b/lib/elements/fill_stitch.py
@@ -597,6 +597,37 @@ class FillStitch(EmbroideryElement):
return self.get_float_param('herringbone_width_mm', 0)
@property
+ @param(
+ 'pull_compensation_mm',
+ _('Pull compensation'),
+ tooltip=_('Fill stitch can pull the fabric together, resulting in a shape narrower than you draw in Inkscape. '
+ 'This setting expands each row of stitches outward from the center of the row by a fixed length. '
+ 'Two values separated by a space may be used for an asymmetric effect.'),
+ select_items=[('fill_method', 'auto_fill')],
+ unit=_('mm (each side)'),
+ type='float',
+ default=0,
+ sort_index=26)
+ @cache
+ def pull_compensation_px(self):
+ return np.maximum(self.get_split_mm_param_as_px("pull_compensation_mm", (0, 0)), 0)
+
+ @property
+ @param(
+ 'pull_compensation_percent',
+ _('Pull compensation percentage'),
+ tooltip=_('Additional pull compensation which varies as a percentage of row width. '
+ 'Two values separated by a space may be used for an asymmetric effect.'),
+ select_items=[('fill_method', 'auto_fill')],
+ unit=_('% (each side)'),
+ type='float',
+ default=0,
+ sort_index=27)
+ @cache
+ def pull_compensation_percent(self):
+ return np.maximum(self.get_split_float_param("pull_compensation_percent", (0, 0)), 0)
+
+ @property
def color(self):
# SVG spec says the default fill is black
return self.get_style("fill", "#000000")
@@ -1027,6 +1058,8 @@ class FillStitch(EmbroideryElement):
self.enable_random_stitch_length,
self.random_stitch_length_jitter,
self.random_seed,
+ self.pull_compensation_px,
+ self.pull_compensation_percent / 100,
)
)
return [stitch_group]