Fix for viewport in classDiagram and stateDiagram renndering

This commit is contained in:
Ashish Jain
2019-10-09 21:15:17 +02:00
parent 54e6e2f66e
commit f8f52c4587
5 changed files with 14 additions and 9 deletions

View File

@@ -92,12 +92,15 @@ export const draw = function(text, id) {
const bounds = diagram.node().getBBox();
// diagram.attr('height', '100%');
diagram.attr('height', '100%');
// diagram.attr('width', 'fit-content');
diagram.attr('style', 'width: fit-content;');
diagram.attr('style', `max-width: ${bounds.width * 1.5 + conf.padding * 2};`);
diagram.attr(
'viewBox',
'0 0 ' + (bounds.width + conf.padding * 2) + ' ' + (bounds.height + conf.padding * 2)
`${conf.padding * -1} ${conf.padding * -1} ` +
(bounds.width * 1.5 + conf.padding * 2) +
' ' +
(bounds.height * 1.5 + conf.padding * 2)
);
};
const getLabelWidth = text => {