mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-19 23:39:50 +02:00
Add er.useMaxWidth
config option
This restores the option of rendering an ERD with an absolute width,
which is consistent with the approach taken with the other diagram
types.
This logic was lost in #1324, which was probably just a small oversight:
9199546dca (diff-7c38d27acbe0676d923bf19283671616L397-L409)
The option defaults to true for backwards compatibility.
This commit is contained in:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user