From 22a50a61812a2d183af882a08debc3fafd93de74 Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Mon, 31 May 2021 17:02:55 +0200 Subject: [PATCH] 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 --- boxes/generators/phoneholder.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/boxes/generators/phoneholder.py b/boxes/generators/phoneholder.py index 34d653e..31e7ac3 100644 --- a/boxes/generators/phoneholder.py +++ b/boxes/generators/phoneholder.py @@ -248,12 +248,13 @@ class SideEdge(edges.BaseEdge): self.reverse = reverse def __call__(self, length, **kw): + tab_start = self.tab_start tab_end = length - self.tab_start - self.tab_length 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( 0, 90, @@ -277,12 +278,13 @@ class TabbedEdge(edges.BaseEdge): self.reverse = reverse def __call__(self, length, **kw): + tab_start = self.tab_start tab_end = length - self.tab_start - self.tab_length 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.fingerHolesAt(0, -self.thickness / 2, self.tab_length, 0)