From e475a7d88c9cc4128852a431dfe1977e426e4efc Mon Sep 17 00:00:00 2001 From: Viatrix Date: Thu, 12 Mar 2026 14:46:44 -0700 Subject: Objects with both fill and stroke now work --- imagemap.py | 2 +- tests/data/refs/imagemap__--maptype__HTML__fillstroke__svg.out | 1 + tests/data/svg/fillstroke.svg | 6 ++++++ tests/test_imagemap_comparison.py | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 tests/data/refs/imagemap__--maptype__HTML__fillstroke__svg.out create mode 100644 tests/data/svg/fillstroke.svg diff --git a/imagemap.py b/imagemap.py index 89452be..3d25403 100644 --- a/imagemap.py +++ b/imagemap.py @@ -70,7 +70,7 @@ class ImageMap(inkex.OutputExtension): if len(links)==0: raise inkex.AbortExtension(_("Image has no hyperlinks.\nAdd a hyperlink to an object with right-click → \"{}\".").format(_("Create Anchor (Hyperlink)"))) 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))) \ + ';'.join(f'select-clear;select-by-selector:[style~="{CSS_LINK_INDEX}-{i}"];object-stroke-to-path;selection-ungroup;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) diff --git a/tests/data/refs/imagemap__--maptype__HTML__fillstroke__svg.out b/tests/data/refs/imagemap__--maptype__HTML__fillstroke__svg.out new file mode 100644 index 0000000..60683ce --- /dev/null +++ b/tests/data/refs/imagemap__--maptype__HTML__fillstroke__svg.out @@ -0,0 +1 @@ + diff --git a/tests/data/svg/fillstroke.svg b/tests/data/svg/fillstroke.svg new file mode 100644 index 0000000..70911c3 --- /dev/null +++ b/tests/data/svg/fillstroke.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/test_imagemap_comparison.py b/tests/test_imagemap_comparison.py index a703b5e..445f981 100644 --- a/tests/test_imagemap_comparison.py +++ b/tests/test_imagemap_comparison.py @@ -5,6 +5,7 @@ class ImageMapComparisonTest(ComparisonMixin, TestCase): effect_class = ImageMap compare_file = ( 'svg/enclave.svg', + 'svg/fillstroke.svg', 'svg/image.svg', 'svg/intersect.svg', 'svg/overlap.svg', -- cgit