mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-18 14:59:53 +02:00
resolves #1490 consistent SVG height and width between diagrams
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
import { parser } from './parser/gantt';
|
||||
import common from '../common/common';
|
||||
import ganttDb from './ganttDb';
|
||||
import { configureSvgSize } from '../../utils';
|
||||
|
||||
parser.yy = ganttDb;
|
||||
|
||||
@@ -53,7 +54,6 @@ export const draw = function(text, id) {
|
||||
// Set height based on number of tasks
|
||||
const h = taskArray.length * (conf.barHeight + conf.barGap) + 2 * conf.topPadding;
|
||||
|
||||
elem.setAttribute('height', '100%');
|
||||
// Set viewBox
|
||||
elem.setAttribute('viewBox', '0 0 ' + w + ' ' + h);
|
||||
const svg = select(`[id="${id}"]`);
|
||||
@@ -97,9 +97,8 @@ export const draw = function(text, id) {
|
||||
taskArray.sort(taskCompare);
|
||||
|
||||
makeGant(taskArray, w, h);
|
||||
if (typeof conf.useWidth !== 'undefined') {
|
||||
elem.setAttribute('width', w);
|
||||
}
|
||||
|
||||
configureSvgSize(elem, h, w, conf.useMaxWidth);
|
||||
|
||||
svg
|
||||
.append('text')
|
||||
|
Reference in New Issue
Block a user