C
C
ClaraOswald2017-08-08 10:52:42
JavaScript
ClaraOswald, 2017-08-08 10:52:42

Why doesn't firefox draw sprites with canvas SVG?

Cnavas in firefox does not draw SVG if it is a sprite, that is, SVG is requested not like this /icons-sprite.svg, but like this /icons-sprite.svg#usd-usage(that is, we say that we need a specific #usd-usage fragment)

let img = new Image();
        img.onload = () => {
          cx.drawImage(img, 7, h-5, 20, 20);
        };
        img.src = '/icons-sprite.svg#usd-usage';

if I try to draw another svg file, NOT a sprite, then everything is fine.
I thought that the problem might be xlink:href replaced with just href did not help
https://jsfiddle.net/ko9rL91z/2/ - example
https://pastebin.com/6LK58Xw5 - SVG example
Any idea what the problem is?
in chrome everything is just fine.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
trushka, 2017-08-08
@trushka

I think you need to set width and height or viewbox for SVG.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question