aboutsummaryrefslogtreecommitdiff
path: root/imagemap.py
diff options
context:
space:
mode:
authorViatrix2026-03-12 14:53:01 -0700
committerViatrix2026-03-12 14:53:01 -0700
commit5aca421003b008e116c170d6be789ac28e602cf7 (patch)
treecc9eb6eddf778f2dfafbf8e09a370fd77b753cf2 /imagemap.py
parente475a7d88c9cc4128852a431dfe1977e426e4efc (diff)
Images with dummy fill and stroke handled correctly.
Diffstat (limited to 'imagemap.py')
-rw-r--r--imagemap.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/imagemap.py b/imagemap.py
index 3d25403..8ab6558 100644
--- a/imagemap.py
+++ b/imagemap.py
@@ -62,10 +62,12 @@ 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)} "'
+ 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['stroke']='none'
+ style['fill']='#000'
links += [link]
if len(links)==0:
raise inkex.AbortExtension(_("Image has no hyperlinks.\nAdd a hyperlink to an object with right-click → \"{}\".").format(_("Create Anchor (Hyperlink)")))