diff options
| author | Viatrix | 2026-03-11 07:54:27 -0700 |
|---|---|---|
| committer | Viatrix | 2026-03-11 07:55:44 -0700 |
| commit | 8cea9e2a48fa7965614997ebee832bb39e7154ca (patch) | |
| tree | 2a1094195d88455842676098c19cfc14dde15729 | |
| parent | 1896ef89104109adffcaeb87274abbfe6759c986 (diff) | |
Transforms working
| -rw-r--r-- | imagemap.py | 2 | ||||
| -rw-r--r-- | tests/data/refs/imagemap__--maptype__HTML__transform__svg.out | 2 | ||||
| -rw-r--r-- | tests/data/svg/transform.svg | 10 | ||||
| -rw-r--r-- | tests/test_imagemap_comparison.py | 1 |
4 files changed, 14 insertions, 1 deletions
diff --git a/imagemap.py b/imagemap.py index a1bd093..9a88a42 100644 --- a/imagemap.py +++ b/imagemap.py @@ -81,7 +81,7 @@ class ImageMap(inkex.OutputExtension): href=link['href'] alt=link['alt'] if int(linkindex) not in seen else None shapes=[] - path=el.get_path().to_superpath() + path=el.get_path().transform(el.composed_transform()).to_superpath() bezier.cspsubdiv(path,0.5) for subpath in path: coords=[[round((c[0][0]-viewBox[0])*wscale),round((c[0][1]-viewBox[1])*hscale)] for c in subpath] diff --git a/tests/data/refs/imagemap__--maptype__HTML__transform__svg.out b/tests/data/refs/imagemap__--maptype__HTML__transform__svg.out new file mode 100644 index 0000000..1c66e47 --- /dev/null +++ b/tests/data/refs/imagemap__--maptype__HTML__transform__svg.out @@ -0,0 +1,2 @@ +<area shape=poly coords=0,0,50,50,100,50,50,0 href=http://example.com/1> +<area shape=poly coords=0,50,50,100,100,100,50,50 href=http://example.com/2> diff --git a/tests/data/svg/transform.svg b/tests/data/svg/transform.svg new file mode 100644 index 0000000..001e2c3 --- /dev/null +++ b/tests/data/svg/transform.svg @@ -0,0 +1,10 @@ +<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <a xlink:href="http://example.com/1"> + <rect x="0" y="0" width="50" height="50" transform="skewX(45)"/> + </a> + <g transform="skewX(45)"> + <a xlink:href="http://example.com/2"> + <rect x="-50" y="50" width="50" height="50"/> + </a> + </g> +</svg> diff --git a/tests/test_imagemap_comparison.py b/tests/test_imagemap_comparison.py index 302162c..087a3d8 100644 --- a/tests/test_imagemap_comparison.py +++ b/tests/test_imagemap_comparison.py @@ -9,6 +9,7 @@ class ImageMapComparisonTest(ComparisonMixin, TestCase): 'svg/rect.svg', 'svg/rounding.svg', 'svg/text.svg', + 'svg/transform.svg', 'svg/viewbox.svg' ) comparisons=[('--maptype=HTML',)] |
