Closed villanus closed 7 years ago
Hi Frank, sorry this took so long, but you can already do this with the svgAttrs
property which lets you override the defaults and add anything you need:
var opts = {
svgAttrs: {
height: null,
width: null,
preserveAspectRatio: 'xMidYMid meet'
}
};
var svg = makerjs.exporter.toSVG(model, opts);
This is in Maker.js but not exposed in this project. I'm assuming you're working off of a fork of this repo.
So the SVG can properly scale it should not have width / height attributes. Instead it should have a preserveAspectRatio with the default value of xMidYMid meet.
https://jsfiddle.net/37Lsg3dk/6/
When the SVG has set dimensions it cannot scale within a container automatically. Only workaround is to set width to 100% and height to auto using css:
https://jsfiddle.net/37Lsg3dk/7/