Issue with displaying icon

Hi,

I have a customized SVG file that I want to use as an icon in my ignition perspective project. I have done this before with another custom SVG but this one is not working for some reason.

The image below shows the icon I created and it works when I upload it as an image into the perspective view, but as an icon I get this weird looking display. I have messed with scaling with no luck it just makes the same image but smaller or larger.
image

I looked at the svg source code in the web development tool kit when I run my ignition project. It shows the viewBox as 0,0,24,24 and my original svg file has the viewBox at 0,0,272,272 is there a way to manually change the viewBox dimensions from Ignition or force it into the larger viewBox? I think this would be my issue, since my original image will not fit into the small viewBox.

Any help is greatly appreciated and if you need my SVG code I can also post that as well. Thank you for the assistance.

Perhaps edit the SVG again, if using Inkscape, set the width and height in the top section and under Viewbox. Adjust the SVG to fit in the area. Then save as plain, I think that works best IMO.

Thanks for the response I however was able to solve my issue from the designer. You can set the viewBox as an object then assign the keys for x, y, width, height. It's a little confusing at first because if you just add the property and select the viewBox component it does not automatically make it an object, so you have to manually select new object and give it the proper key names.

It is Highly recommended to make the svg with a 24x24 viewBox as the standard so it fits automatically, but if you need to adjust it for whatever reason you can use this method.

Neat!

However, that seems like a maintenance nightmare for the person that has to go behind you. They drop an icon and then wonder why it doesn't look right.

Do you think it is better practice to make it a 24 x 24 viewBox then? And is that something to easily achieve with Inkscape? Cause I agree it would be a pain if every time you drop a new icon it has to get a viewBox adjustment, it would be easier to just have it fit immediately.

I believe the "native" icons are set that way, so I try and stay consistent if possible.

Attach the SVG and I can try and work with it, but to your question, yes it should be easy in Inkscape.

Thank you for the advice, my issue is resolved but I think from now on it does make sense to make the icons with a 24 x 24 viewBox.

1 Like