summaryrefslogtreecommitdiff
path: root/lib/elements/auto_fill.py
diff options
context:
space:
mode:
authorLex Neva <lexelby@users.noreply.github.com>2018-06-29 21:26:03 -0400
committerGitHub <noreply@github.com>2018-06-29 21:26:03 -0400
commit4d7b07ff02e13f237fac8eb8715fe4a6324ea6dc (patch)
treef1c29df5f29d5bfefb48513043116b73209f202d /lib/elements/auto_fill.py
parent7c8cd648a36e10e5ebfb94ce27be76e5ba47f334 (diff)
parentde4ead1ad467997fa81a4459e194769dfab185e2 (diff)
Merge pull request #212 from inkstitch/lexelby-fill-markers
fill start/end
Diffstat (limited to 'lib/elements/auto_fill.py')
-rw-r--r--lib/elements/auto_fill.py26
1 files changed, 21 insertions, 5 deletions
diff --git a/lib/elements/auto_fill.py b/lib/elements/auto_fill.py
index 504bae2a..59816878 100644
--- a/lib/elements/auto_fill.py
+++ b/lib/elements/auto_fill.py
@@ -100,13 +100,28 @@ class AutoFill(Fill):
def fill_shape(self):
return self.shrink_or_grow_shape(self.expand)
+ def get_starting_point(self, last_patch):
+ # If there is a "fill_start" Command, then use that; otherwise pick
+ # the point closest to the end of the last patch.
+
+ if self.get_command('fill_start'):
+ return self.get_command('fill_start').target_point
+ elif last_patch:
+ return last_patch.stitches[-1]
+ else:
+ return None
+
+ def get_ending_point(self):
+ if self.get_command('fill_end'):
+ return self.get_command('fill_end').target_point
+ else:
+ return None
+
def to_patches(self, last_patch):
stitches = []
- if last_patch is None:
- starting_point = None
- else:
- starting_point = last_patch.stitches[-1]
+ starting_point = self.get_starting_point(last_patch)
+ ending_point = self.get_ending_point()
if self.fill_underlay:
stitches.extend(auto_fill(self.underlay_shape,
@@ -126,6 +141,7 @@ class AutoFill(Fill):
self.max_stitch_length,
self.running_stitch_length,
self.staggers,
- starting_point))
+ starting_point,
+ ending_point))
return [Patch(stitches=stitches, color=self.color)]