diff options
| -rw-r--r-- | imagemap.py | 2 | ||||
| -rw-r--r-- | tests/data/refs/imagemap__--maptype__HTML__image__svg.out (renamed from tests/data/refs/imagemap__--maptype__HTML__rect__svg.out) | 0 | ||||
| -rw-r--r-- | tests/data/svg/image.svg | 6 | ||||
| -rw-r--r-- | tests/data/svg/rect.svg | 5 | ||||
| -rw-r--r-- | tests/test_imagemap_comparison.py | 2 |
5 files changed, 9 insertions, 6 deletions
diff --git a/imagemap.py b/imagemap.py index 22789f0..89452be 100644 --- a/imagemap.py +++ b/imagemap.py @@ -62,6 +62,8 @@ class ImageMap(inkex.OutputExtension): link={attr:AREA_ATTRS[attr](a) for attr in AREA_ATTRS.keys()} for el in a.iterdescendants(): # CSS is preserved when flattening (for paths) if not isinstance(el,inkex.ShapeElement): continue + if el.tag=='{http://www.w3.org/2000/svg}image': + el.tag='{http://www.w3.org/2000/svg}rect' # because flattening an image creates a clip-path style=el.effective_style() style[CSS_LINK_INDEX]=f'" {CSS_LINK_INDEX}-{len(links)} "' links += [link] diff --git a/tests/data/refs/imagemap__--maptype__HTML__rect__svg.out b/tests/data/refs/imagemap__--maptype__HTML__image__svg.out index 9399c1c..9399c1c 100644 --- a/tests/data/refs/imagemap__--maptype__HTML__rect__svg.out +++ b/tests/data/refs/imagemap__--maptype__HTML__image__svg.out diff --git a/tests/data/svg/image.svg b/tests/data/svg/image.svg new file mode 100644 index 0000000..e0d62d4 --- /dev/null +++ b/tests/data/svg/image.svg @@ -0,0 +1,6 @@ +<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <!-- Transparent areas of the image should remain part of the link. --> + <a xlink:href="http://example.com"> + <image x="25" y="25" width="50" height="50" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAQAAADYv8WvAAAADUlEQVR42mMAgv9gBAAJAQH/66EXCgAAAABJRU5ErkJggg==" image-rendering="optimizeSpeed"/> + </a> +</svg> diff --git a/tests/data/svg/rect.svg b/tests/data/svg/rect.svg deleted file mode 100644 index 445e6e0..0000000 --- a/tests/data/svg/rect.svg +++ /dev/null @@ -1,5 +0,0 @@ -<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"> - <rect x="25" y="25" width="50" height="50"/> - </a> -</svg> diff --git a/tests/test_imagemap_comparison.py b/tests/test_imagemap_comparison.py index 959e98e..a703b5e 100644 --- a/tests/test_imagemap_comparison.py +++ b/tests/test_imagemap_comparison.py @@ -5,9 +5,9 @@ class ImageMapComparisonTest(ComparisonMixin, TestCase): effect_class = ImageMap compare_file = ( 'svg/enclave.svg', + 'svg/image.svg', 'svg/intersect.svg', 'svg/overlap.svg', - 'svg/rect.svg', 'svg/rounding.svg', 'svg/text.svg', 'svg/transform.svg', |
