I’m working on plugin which would export some design from Adobe XD to third-party tool.
There is a Pen tool which allows drawing lines and curves. These lines and curves are Path type. There is a pathData property in Path type - it return SVG data in Absolute coordinates. And I need an SVG data in Relative coordinates.
I couldn’t find out what is the start point for these absolute coordinates. For example, I have 800x1200 size Artboard, where I have some Pen drawing with top left coordinates like 10, 10. The pathData property of this drawing returns something like:
M 6158.45703125 6874.39697265625 C 6065.7451171875 6985.994140625 5948.9970703125 7071.83837890625 6112.10107421875 7015.18115234375 C 6275.205078125 6958.52392578125 6146.8681640625 6903.15478515625 6158.45703125 6865.8125
4000? 6000? The artboard is not even 1000 size by it’s width, and the size of Pen drawing is like 300x300.
So all solutions I found in the Interned use HTML with element inside to convert coordinates - which is not quite my case. So how do I convert this coordinates to Relative with Javascript only?
Thanks!
P.S. It would be great to have this functionality as part of Adobe XD API. Something like Path.relativePathData. Because it’s much more reliable to get path data from existing SVG, than parsing/converting it with possible errors.