From 1b0245c52c8a1a9cb47398d359cc8c9ac0618dad Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Fri, 10 Mar 2023 22:15:40 -0500 Subject: add reverse one rail param --- lib/elements/satin_column.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'lib/elements') diff --git a/lib/elements/satin_column.py b/lib/elements/satin_column.py index 8c39b4d2..1d856e10 100644 --- a/lib/elements/satin_column.py +++ b/lib/elements/satin_column.py @@ -210,6 +210,17 @@ class SatinColumn(EmbroideryElement): # wider than we desire the column to end up. return self.get_split_mm_param_as_px("pull_compensation_mm", (0, 0)) + @property + @param( + 'reverse_one_rail', + _('Reverse one rail'), + tooltip=_('Enabling this may help if your satin renders very strangely.'), + type='boolean', + default='false', + sort_index=10) + def reverse_one_rail(self): + return self.get_boolean_param('reverse_one_rail', False) + @property @param( 'swap_satin_rails', @@ -217,7 +228,8 @@ class SatinColumn(EmbroideryElement): tooltip=_('Swaps the first and second rails of the satin column, ' 'affecting which side the thread finished on as well as any sided properties'), type='boolean', - default='false') + default='false', + sort_index=11) def swap_rails(self): return self.get_boolean_param('swap_satin_rails', False) @@ -381,7 +393,12 @@ class SatinColumn(EmbroideryElement): @cache def flattened_rails(self): """The rails, as LineStrings.""" - return tuple(shgeo.LineString(self.flatten_subpath(rail)) for rail in self.rails) + paths = [shgeo.LineString(self.flatten_subpath(rail)) for rail in self.rails] + + if paths and self.reverse_one_rail: + paths[0] = shgeo.LineString(paths[0].coords[::-1]) + + return tuple(paths) @property @cache -- cgit v1.2.3