Merge pull request #1534 from 72636c/feature/er_use_max_width

Add `er.useMaxWidth` config option
This commit is contained in:
Knut Sveidqvist
2020-07-12 10:51:00 +02:00
committed by GitHub
4 changed files with 58 additions and 6 deletions

View File

@@ -339,9 +339,14 @@ export const draw = function(text, id) {
const width = svgBounds.width + padding * 2;
const height = svgBounds.height + padding * 2;
svg.attr('height', height);
svg.attr('width', '100%');
svg.attr('style', `max-width: ${width}px;`);
if (conf.useMaxWidth) {
svg.attr('width', '100%');
svg.attr('style', `max-width: ${width}px;`);
} else {
svg.attr('height', height);
svg.attr('width', width);
}
svg.attr('viewBox', `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`);
}; // draw