polygonWall: Fix margin calculation

by tracing the outline of the edge margins.

Fixes 1875742b8d
This commit is contained in:
Florian Festi 2023-01-04 13:30:14 +01:00
parent a477dbd412
commit a01bc11cb7
1 changed files with 18 additions and 7 deletions

View File

@ -2612,6 +2612,24 @@ class Boxes:
ext[2] = max(ext[2], x)
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)):
if i % 2:
try:
@ -2649,13 +2667,6 @@ class Boxes:
posy += borders[i] * math.sin(math.radians(angle))
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
def polygonWall(self, borders, edge="f", turtle=False,