PhoneHolder: Fix edge of second side being reversed

The code switched sides for each edges draen reversed. Change that to
only reverse local variables and leave the edge objects unchanged.

Thanks to https://github.com/ChrisLaserman for reporting!

Resolves: #324
This commit is contained in:
Florian Festi 2021-05-31 17:02:55 +02:00
parent 83f711b07a
commit 22a50a6181
1 changed files with 6 additions and 4 deletions

View File

@ -248,12 +248,13 @@ class SideEdge(edges.BaseEdge):
self.reverse = reverse self.reverse = reverse
def __call__(self, length, **kw): def __call__(self, length, **kw):
tab_start = self.tab_start
tab_end = length - self.tab_start - self.tab_length tab_end = length - self.tab_start - self.tab_length
if self.reverse: if self.reverse:
self.tab_start, tab_end = tab_end, self.tab_start tab_start, tab_end = tab_end, tab_start
self.edges["F"](self.tab_start) self.edges["F"](tab_start)
self.polyline( self.polyline(
0, 0,
90, 90,
@ -277,12 +278,13 @@ class TabbedEdge(edges.BaseEdge):
self.reverse = reverse self.reverse = reverse
def __call__(self, length, **kw): def __call__(self, length, **kw):
tab_start = self.tab_start
tab_end = length - self.tab_start - self.tab_length tab_end = length - self.tab_start - self.tab_length
if self.reverse: if self.reverse:
self.tab_start, tab_end = tab_end, self.tab_start tab_start, tab_end = tab_end, tab_start
self.edges["f"](self.tab_start) self.edges["f"](tab_start)
self.ctx.save() self.ctx.save()
self.fingerHolesAt(0, -self.thickness / 2, self.tab_length, 0) self.fingerHolesAt(0, -self.thickness / 2, self.tab_length, 0)