Search code examples
canvassvgviewboxfabricjs

FabricJS support for SVG viewBox element?


Does fabricJS support SVG viewBox element so that it will render only that on canvas? That way, zooming of the entire screen could be implemented easily.


Solution

  • No, FabricJS is Canvas-based and Canvas and SVG are two very different realms.

    FabricJS can parse SVG paths and draw them onto a canvas, but thats it.

    Specifically, the SVG elements that FabricJS can parse and draw to a canvas are: path, circle, polygon, polyline, ellipse, rect, line, and image.