summaryrefslogtreecommitdiff
path: root/gerbonara/utils.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2023-04-06 16:27:57 +0200
committerjaseg <git@jaseg.de>2023-04-10 23:57:15 +0200
commit0dcd2814061e8ee93bfef9484a3b3de56d156ff9 (patch)
tree0fbe7c71ae728b6e97adf0374cf686bbb1573440 /gerbonara/utils.py
parentba920604311d73fd3a9563d4fcb147d508f080cf (diff)
downloadgerbonara-0dcd2814061e8ee93bfef9484a3b3de56d156ff9.tar.gz
gerbonara-0dcd2814061e8ee93bfef9484a3b3de56d156ff9.tar.bz2
gerbonara-0dcd2814061e8ee93bfef9484a3b3de56d156ff9.zip
Make generated pretty SVGs smaller
Diffstat (limited to 'gerbonara/utils.py')
-rw-r--r--gerbonara/utils.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/gerbonara/utils.py b/gerbonara/utils.py
index ce5425a..e33a7bf 100644
--- a/gerbonara/utils.py
+++ b/gerbonara/utils.py
@@ -461,7 +461,10 @@ def svg_arc(old, new, center, clockwise):
def svg_rotation(angle_rad, cx=0, cy=0):
- return f'rotate({float(math.degrees(angle_rad)):.4} {float(cx):.6} {float(cy):.6})'
+ if math.isclose(angle_rad, 0.0, abs_tol=1e-3):
+ return {}
+ else:
+ return {'transform': f'rotate({float(math.degrees(angle_rad)):.4} {float(cx):.6} {float(cy):.6})'}
def setup_svg(tags, bounds, margin=0, arg_unit=MM, svg_unit=MM, pagecolor='white', tag=Tag, inkscape=False):
(min_x, min_y), (max_x, max_y) = bounds