UBox: Limit radius to possible values and merge flex if radii touch

This commit is contained in:
Florian Festi 2017-02-15 19:33:10 +01:00
parent 0398c3ae98
commit 5e33d057fc
1 changed files with 8 additions and 3 deletions

View File

@ -75,9 +75,12 @@ class UBox(_TopEdge, _ChestLid):
for nr, flex in enumerate("XE"): for nr, flex in enumerate("XE"):
self.edges["F"](y-r) self.edges["F"](y-r)
self.edges[flex](cl, h=th) if x-2*r > 0.1 * self.thickness:
self.edges["F"](x-2*r) self.edges[flex](cl, h=th)
self.edges[flex](cl, h=th) self.edges["F"](x-2*r)
self.edges[flex](cl, h=th)
else:
self.edges[flex](2*cl+x-2*r, h=th)
self.edges["F"](y-r) self.edges["F"](y-r)
self.edgeCorner("F", e[nr]) self.edgeCorner("F", e[nr])
e[nr](h) e[nr](h)
@ -88,6 +91,8 @@ class UBox(_TopEdge, _ChestLid):
def render(self): def render(self):
x, y, h, r = self.x, self.y, self.h, self.radius x, y, h, r = self.x, self.y, self.h, self.radius
self.radius = r = min(r, x/2.0, y)
self.open() self.open()
t1, t2, t3, t4 = self.topEdges(self.top_edge) t1, t2, t3, t4 = self.topEdges(self.top_edge)