From c45b5cd30bb69e95d7eb93160bf8ccc4ac9b868a Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Fri, 19 Oct 2018 18:58:29 +0200 Subject: [PATCH] Add debug rectangle for move commands --- boxes/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/boxes/__init__.py b/boxes/__init__.py index 1bab0ec..f89fc11 100755 --- a/boxes/__init__.py +++ b/boxes/__init__.py @@ -973,15 +973,17 @@ class Boxes: for term in terms: if not term in moves: raise ValueError("Unknown direction: '%s'" % term) - x, y, movebeforeprint = moves[term] + mx, my, movebeforeprint = moves[term] if movebeforeprint and before: - self.moveTo(x, y) + self.moveTo(mx, my) elif (not movebeforeprint and not before) or dontdraw: - self.moveTo(x, y) + self.moveTo(mx, my) if not dontdraw: if before: # save position self.ctx.save() + if self.debug: + self.ctx.rectangle(0, 0, x, y) self.moveTo(self.spacing / 2.0, self.spacing / 2.0) return dontdraw