From 1896ef89104109adffcaeb87274abbfe6759c986 Mon Sep 17 00:00:00 2001 From: Viatrix Date: Wed, 11 Mar 2026 07:36:02 -0700 Subject: `` elements now working --- imagemap.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'imagemap.py') diff --git a/imagemap.py b/imagemap.py index 4c4c931..a1bd093 100644 --- a/imagemap.py +++ b/imagemap.py @@ -59,13 +59,15 @@ class ImageMap(inkex.OutputExtension): for a in self.svg.iterdescendants('{http://www.w3.org/2000/svg}a'): # save link attributes because they get removed when flattening link={attr:AREA_ATTRS[attr](a) for attr in AREA_ATTRS.keys()} - for el in a.iterdescendants(): # CSS is preserved when flattening BUT NOT IN TEXT SO WE GOTTA FIGURE OUT HOW TODO TEXT + for el in a.iterdescendants(): # CSS is preserved when flattening (for paths) if not isinstance(el,inkex.ShapeElement): continue style=el.effective_style() style[CSS_LINK_INDEX]=f'" {CSS_LINK_INDEX}-{len(links)} "' links += [link] - command='select-all;path-flatten;'+ \ - ';'.join(f'select-clear;select-by-selector:[style~="{CSS_LINK_INDEX}-{i}"];path-union;path-split' for i in range(len(links))) + command=\ + ';'.join(f'select-clear;select-by-selector:[style~="{CSS_LINK_INDEX}-{i}"];object-stroke-to-path;path-union;object-set-attribute:style,{CSS_LINK_INDEX}:" {CSS_LINK_INDEX}-{i} "' for i in range(len(links))) \ + +';select-all;path-flatten;path-split' + # (we re-set the existing style attribute in case it got unset on non-paths) newbytes=inkscape_command(self.svg,actions=command) self.svg=self.load(newbytes).getroot() -- cgit