Wrong clip/translate when exporting individual SVG icons within a frame

Lunacy version: 10.0.1
OS version: Windows 10

I’ve been having problems with exporting individual icons/graphics to SVG when they are placed inside a frame.

In Lunacy 9.6.1, so long as ‘Clip Content’ was turned off on the icon’s design properties, this resulted in the exported SVG containing a “harmless” invisible path that was outside the viewbox so although unnecessary and inappropriate did not harm the rendering of the SVG:

<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">
  <g id="icon">
    <path d="M16 -308L16 -308L16 -292L0 -292L0 -308L16 -308Z" id="icon" fill="none" stroke="none" />
   ...

In Lunacy 10.0.1 the behaviour has changed and instead the entire icon graphic is translated outside the viewbox:

<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="none" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">
  <g id="icon" opacity="1" transform="translate(308 292)">
    <path d="M16 0L16 0L16 16L0 16L0 0L16 0Z" style="mix-blend-mode:normal;" />
   ...

Viewing the resulting SVG just shows a blank empty picture, since the graphic is outside the viewbox. The same thing happens when exporting a single group or shape, not just with icons.

The only way I have found to prevent Lunacy from doing this is to move the icon outside of the parent frame, placing it directly onto the workspace background. Exporting it from there results in the transform=“translate(…)” element disappearing from the SVG, and it then renders OK. This is not an ideal workaround because it means there is no easy way to group sets of icons under separate frames when working on a multi-icon project, and the icon names are displayed messily above each icon, which they are not when placed in a frame.

I believe this is a bug - when selecting to export icons, shapes and groups nested within a frame their relative position on that frame should be disregarded.

Here’s an image illustrating the problem, I can send the Lunacy .free file if you want it:

Hi Matt!

First of all, thank you for your comprehensive and detailed report on this issue! We’re going to start working on this SVG export bug right away. I can’t give you an ETA yet, but I’ll make sure to let you know when the fix is out.

Matt, we’ve fixed this issue! Please check if everything is fine on your side, too.

Thanks Alex, I tested with the latest beta release, 10.1.0.1014 and this issue is now fixed - the icon stays within its viewbox now and the result is exactly the same whether exported from positioned inside a frame or from on the workspace. Very good result and thanks guys!

2 Likes