svg.filter.js icon indicating copy to clipboard operation
svg.filter.js copied to clipboard

how to remove the filter nodes, after unfilter?

Open webstermobile opened this issue 2 years ago • 1 comments

after unfilter I still can see the following code in the dom, so, how to remove these ? <filter id="SvgjsFilter1005"><feFlood id="SvgjsFeFlood1000" result="SvgjsFeFlood1000" in="SourceGraphic" flood-opacity="1" flood-color="#4e00b1"></feFlood><feComposite id="SvgjsFeComposite1001" result="SvgjsFeComposite1001" in="SvgjsFeFlood1000" operator="in" in2="SourceGraphic"></feComposite><feGaussianBlur id="SvgjsFeGaussianBlur1002" result="SvgjsFeGaussianBlur1002" in="SvgjsFeComposite1001" stdDeviation="3 3"></feGaussianBlur><feOffset id="SvgjsFeOffset1003" result="SvgjsFeOffset1003" in="SvgjsFeGaussianBlur1002" dy="0" dx="0"></feOffset><feBlend id="SvgjsFeBlend1004" result="SvgjsFeBlend1004" in="SourceGraphic" in2="SvgjsFeOffset1003"></feBlend></filter>

webstermobile avatar May 10 '22 02:05 webstermobile

@webstermobile I also ran into this issue when I tried to remove a filter attached to an image. You can remove it manually.

    const attachedFilter = svgImage.filterer();
    if (attachedFilter) {
      svgImage.unfilter();
      // clean up <defs>
      const filterIndex = svgImage.defs().index(attachedFilter);
      svgImage.defs().get(filterIndex).remove();
    }

ibohatyrchuk avatar Jul 04 '22 19:07 ibohatyrchuk