Flexbox4: Limit radius to sane values

This commit is contained in:
Florian Festi 2016-07-09 10:54:05 +02:00
parent 281c80b4e9
commit 70d46dd06a
1 changed files with 3 additions and 1 deletions

View File

@ -69,9 +69,11 @@ class FlexBox(Boxes):
self.corner(90) self.corner(90)
def render(self): def render(self):
self.radius = self.radius or min(self.x, self.y)/2.0
self.c4 = c4 = math.pi * self.radius * 0.5 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.open() self.open()