Flexbox2: Limit radius to sane values

This commit is contained in:
Florian Festi 2016-07-09 10:35:45 +02:00
parent 2043ee6d8a
commit f65bafbcac
1 changed files with 4 additions and 2 deletions

View File

@ -67,9 +67,11 @@ class FlexBox(Boxes):
self.corner(90) self.corner(90)
def render(self): def render(self):
self.radius = self.radius or min(x, y)/2.0
self.c4 = c4 = math.pi * self.radius * 0.5
self.latchsize = 8*self.thickness self.latchsize = 8*self.thickness
self.radius = self.radius or min(self.x/2.0, self.y-self.latchsize)
self.radius = min(self.radius, self.x/2.0)
self.radius = min(self.radius, max(0, self.y-self.latchsize))
self.c4 = c4 = math.pi * self.radius * 0.5
self.open() self.open()