verbb / icon-picker

A Craft CMS field to select SVG or font icons from a folder for use in your content.
Other
17 stars 8 forks source link

Icons out of a svg sprite are not shown at CP #31

Closed DavidKabelitz closed 4 years ago

DavidKabelitz commented 4 years ago

Description

Hi, we use an icon sprite as source for some icons. Sprite and Icons are recognized, searching for an icon went all well. Just the icons themselves are not visible.

Bildschirmfoto 2020-05-19 um 19 16 28

Additional info

engram-design commented 4 years ago

Would you be able to share your sprites file?

DavidKabelitz commented 4 years ago

Sure, it's attached. I just added some inline css to check if it will effect.

200429_iconmap-sprites.svg.zip

engram-design commented 4 years ago

This looks like its a incorrectly defined sprite map. Where definitions are:

<symbol id="auslastung">

They should include the viewbox

<symbol id="auslastung"  viewBox="0 0 60 60">

I'm basing this off a number of widely-used sprite sheets like Icomoon. I can see the viewbox is definde on the outed <svg> element.

I've tried to fix this in the plugin, but haven't had much like defining sizes on the injected sprite...

DavidKabelitz commented 4 years ago

Don't know if i am getting it right. So if we include the viewBox at each symbol it should work?

engram-design commented 4 years ago

Yep, that's correct

DavidKabelitz commented 4 years ago

ok awesome, i will test it - thx

DavidKabelitz commented 4 years ago

no change...still look the same...all caches are deleted.

engram-design commented 4 years ago

Hmm, I managed to get it working - image

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
     width="60px" height="60px" viewBox="0 0 60 60" xml:space="preserve" style="enable-background:new 0 0 60 60;">
<style type="text/css">
    .st0{fill: #ff0000;}
</style>

        <symbol id="auslastung"  viewBox="0 0 60 60" ><path class="st0" d="M56.6,38.9L56.6,38.9c0.1-0.1,0.1-0.1,0.1-0.2c0,0,0,0,0-0.1v-0.1l0,0l0,0
    c-0.4-3.7-1.5-7.2-3.4-10.4l0,0l0,0c0-0.1-0.1-0.1-0.1-0.2c-2.4-4.1-5.7-7.4-9.7-9.7l0,0h-0.1c-2-1.2-4.2-2.1-6.5-2.7
    c-2.2-0.6-4.5-0.9-6.8-0.9H30l0,0l0,0c0,0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7v-2.4c2,0.1,3.9,0.3,5.9,0.8s3.9,1.3,5.7,2.3L41,21c-0.2,0.3-0.1,0.7,0.2,0.9
    c0.1,0.1,0.2,0.1,0.3,0.1c0.2,0,0.5-0.1,0.6-0.3l1.2-2.1c3.4,2.1,6.3,5,8.4,8.5l-2.1,1.2c-0.3,0.2-0.4,0.6-0.3,0.9
    c0.1,0.2,0.4,0.3,0.6,0.3c0.1,0,0.2,0,0.3-0.1l2.1-1.2c1.5,2.7,2.4,5.6,2.8,8.7c-1.9,0.5-3.8,1-5.7,1.5L47.8,39.9z M40.6,37.6
    l-6.8,1.9c-0.4-0.8-1-1.5-1.8-1.9c-1-0.5-2.1-0.7-3.2-0.4s-2,1-2.5,2s-0.7,2.1-0.4,3.2c0.5,1.8,2.2,3.1,4.1,3.1
    c0.4,0,0.8-0.1,1.2-0.2c1.1-0.3,2-1,2.5-2c0.4-0.8,0.6-1.7,0.5-2.5l6.8-1.9c0.4-0.1,0.6-0.5,0.5-0.8C41.3,37.7,41,37.5,40.6,37.6z
     M30.8,44.1c-0.7,0.2-1.5,0.1-2.2-0.2c-0.7-0.4-1.1-1-1.4-1.7s-0.1-1.5,0.2-2.2c0.4-0.7,1-1.1,1.7-1.4c0.3-0.1,0.5-0.1,0.8-0.1
    c0.5,0,1,0.1,1.4,0.4c0.7,0.4,1.1,1,1.4,1.7C33.2,42,32.3,43.6,30.8,44.1z"/></symbol>

You'll need to re-save the field, but sounds like you've already cleared the caches, so that seems odd.

DavidKabelitz commented 4 years ago

ok weird...i will delete the field and try it again with a new one.

DavidKabelitz commented 4 years ago

ok finally it's working. Thanks a lot!