resolves #1490 consistent SVG height and width between diagrams

This commit is contained in:
Guillaume Grossetie
2020-08-23 15:45:23 +02:00
parent 459e07834c
commit 184fcab0b7
15 changed files with 242 additions and 192 deletions

View File

@@ -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')