diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/extensions/lettering_force_lock_stitches.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/extensions/lettering_force_lock_stitches.py b/lib/extensions/lettering_force_lock_stitches.py index a04fac79..ee6accf6 100644 --- a/lib/extensions/lettering_force_lock_stitches.py +++ b/lib/extensions/lettering_force_lock_stitches.py @@ -10,7 +10,7 @@ from ..elements import iterate_nodes, nodes_to_elements from ..i18n import _ from ..marker import has_marker from ..svg import PIXELS_PER_MM -from ..svg.tags import EMBROIDERABLE_TAGS +from ..svg.tags import EMBROIDERABLE_TAGS, SVG_GROUP_TAG from .base import InkstitchExtension @@ -28,6 +28,7 @@ class LetteringForceLockStitches(InkstitchExtension): self.arg_parser.add_argument("-a", "--max_distance", type=float, default=3, dest="max_distance") self.arg_parser.add_argument("-i", "--min_distance", type=float, default=1, dest="min_distance") self.arg_parser.add_argument("-l", "--last_element", type=inkex.Boolean, dest="last_element") + self.arg_parser.add_argument("-g", "--last_group_element", type=inkex.Boolean, dest="last_group_element") def effect(self): if self.options.max_distance < self.options.min_distance: @@ -43,6 +44,8 @@ class LetteringForceLockStitches(InkstitchExtension): # Set glyph layers to be visible. We don't want them to be ignored by self.elements self._update_layer_visibility('inline') for layer in glyph_layers: + if uses_glyph_layers and self.options.last_group_element: + self._set_force_attribute_on_last_group_elements(layer) if uses_glyph_layers and self.options.last_element: self._set_force_attribute_on_last_elements(layer) if self.options.distance: @@ -52,6 +55,11 @@ class LetteringForceLockStitches(InkstitchExtension): # unhide glyph layers self._update_layer_visibility('none') + def _set_force_attribute_on_last_group_elements(self, layer): + group_nodes = list(layer.iterdescendants(SVG_GROUP_TAG)) + for group in group_nodes: + self._set_force_attribute_on_last_elements(group) + def _set_force_attribute_on_last_elements(self, layer): # find the last path that does not carry a marker or belongs to a visual command and add a trim there last_element = None |
