Fix @restore decorator and hole() to no longer keep the current point
This commit is contained in:
parent
bd24170bcf
commit
35347edeb4
6
boxes.py
6
boxes.py
|
@ -11,8 +11,10 @@ def restore(func):
|
||||||
@wraps(func)
|
@wraps(func)
|
||||||
def f(self, *args, **kw):
|
def f(self, *args, **kw):
|
||||||
self.ctx.save()
|
self.ctx.save()
|
||||||
|
pt = self.ctx.get_current_point()
|
||||||
func(self, *args, **kw)
|
func(self, *args, **kw)
|
||||||
self.ctx.restore()
|
self.ctx.restore()
|
||||||
|
self.ctx.move_to(*pt)
|
||||||
return f
|
return f
|
||||||
|
|
||||||
|
|
||||||
|
@ -325,12 +327,10 @@ class Boxes:
|
||||||
self.fingerHoles(length)
|
self.fingerHoles(length)
|
||||||
self.ctx.restore()
|
self.ctx.restore()
|
||||||
|
|
||||||
|
@restore
|
||||||
def hole(self, x, y, r):
|
def hole(self, x, y, r):
|
||||||
self.ctx.save()
|
|
||||||
self.moveTo(x+r, y)
|
self.moveTo(x+r, y)
|
||||||
self.ctx.arc(-r, 0, r, 0, 2*math.pi)
|
self.ctx.arc(-r, 0, r, 0, 2*math.pi)
|
||||||
self.ctx.restore()
|
|
||||||
|
|
||||||
# hexHoles
|
# hexHoles
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue