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-06 16:27:57 +0200
commit6378a91f3614c5258c0037eb4eb1f28d160ed346 (patch)
tree030dd81971fbeb5a12731fbabe8c7511144a0453 /gerbonara/utils.py
parentef2864cfb329683b1c7cdc7f3a991b7aa94cacbe (diff)
downloadgerbonara-6378a91f3614c5258c0037eb4eb1f28d160ed346.tar.gz
gerbonara-6378a91f3614c5258c0037eb4eb1f28d160ed346.tar.bz2
gerbonara-6378a91f3614c5258c0037eb4eb1f28d160ed346.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