# HG changeset patch # User Thierry Florac # Date 1571395586 -7200 # Node ID a845b564608f12f96cc8ffdd6059c47048312c0d # Parent d99436198c5f55e88bb2814a0b9ce649cb0cbf97 Added method to convert image map coordinates to SVG polygon coordinates diff -r d99436198c5f -r a845b564608f src/pyams_content/shared/imagemap/__init__.py --- a/src/pyams_content/shared/imagemap/__init__.py Wed Oct 16 18:52:12 2019 +0200 +++ b/src/pyams_content/shared/imagemap/__init__.py Fri Oct 18 12:46:26 2019 +0200 @@ -48,6 +48,13 @@ link = FieldProperty(IImageMapArea['link']) area = FieldProperty(IImageMapArea['area']) + @property + def svg_points(self): + points = self.area.split(',') + x = points[::2] + y = points[1::2] + return ' '.join(','.join(xy) for xy in zip(x, y)) + @implementer(IWfImageMap, IExtFileContainerTarget, ILinkContainerTarget, IPreviewTarget, IReviewTarget)