polygonWall: Fix margin calculation
by tracing the outline of the edge margins.
Fixes 1875742b8d
This commit is contained in:
parent
a477dbd412
commit
a01bc11cb7
|
@ -2612,6 +2612,24 @@ class Boxes:
|
||||||
ext[2] = max(ext[2], x)
|
ext[2] = max(ext[2], x)
|
||||||
ext[3] = max(ext[3], y)
|
ext[3] = max(ext[3], y)
|
||||||
|
|
||||||
|
# trace edge margins
|
||||||
|
nborders = []
|
||||||
|
for i, val in enumerate(borders):
|
||||||
|
if i % 2:
|
||||||
|
nborders.append(val)
|
||||||
|
else:
|
||||||
|
edge = edges[(i//2)%len(edges)]
|
||||||
|
margin = edge.margin()
|
||||||
|
try:
|
||||||
|
l = val[0]
|
||||||
|
except TypeError:
|
||||||
|
l = val
|
||||||
|
if margin:
|
||||||
|
nborders.extend([0.0, -90, margin, 90, l, 90, margin, -90, 0.0])
|
||||||
|
else:
|
||||||
|
nborders.append(val)
|
||||||
|
|
||||||
|
borders = nborders
|
||||||
for i in range(len(borders)):
|
for i in range(len(borders)):
|
||||||
if i % 2:
|
if i % 2:
|
||||||
try:
|
try:
|
||||||
|
@ -2649,13 +2667,6 @@ class Boxes:
|
||||||
posy += borders[i] * math.sin(math.radians(angle))
|
posy += borders[i] * math.sin(math.radians(angle))
|
||||||
checkpoint(ext, posx, posy)
|
checkpoint(ext, posx, posy)
|
||||||
|
|
||||||
margin = max((e.margin() for e in edges))
|
|
||||||
|
|
||||||
ext[0] -= margin
|
|
||||||
ext[1] -= margin
|
|
||||||
ext[2] += margin
|
|
||||||
ext[3] += margin
|
|
||||||
|
|
||||||
return ext
|
return ext
|
||||||
|
|
||||||
def polygonWall(self, borders, edge="f", turtle=False,
|
def polygonWall(self, borders, edge="f", turtle=False,
|
||||||
|
|
Loading…
Reference in New Issue