#1029 Linting fixes

This commit is contained in:
Knut Sveidqvist
2019-10-24 19:46:42 +02:00
parent d1c74070ab
commit 8f8638fb7c
2 changed files with 41 additions and 34 deletions

View File

@@ -276,7 +276,7 @@ export const getClasses = function(text) {
* @param text * @param text
* @param id * @param id
*/ */
export const draw = function (text, id) { export const draw = function(text, id) {
logger.info('Drawing flowchart'); logger.info('Drawing flowchart');
flowDb.clear(); flowDb.clear();
const parser = flow.parser; const parser = flow.parser;
@@ -308,7 +308,7 @@ export const draw = function (text, id) {
marginx: 8, marginx: 8,
marginy: 8 marginy: 8
}) })
.setDefaultEdgeLabel(function () { .setDefaultEdgeLabel(function() {
return {}; return {};
}); });
} else { } else {
@@ -321,7 +321,7 @@ export const draw = function (text, id) {
marginx: 20, marginx: 20,
marginy: 20 marginy: 20
}) })
.setDefaultEdgeLabel(function () { .setDefaultEdgeLabel(function() {
return {}; return {};
}); });
} }
@@ -403,7 +403,7 @@ export const draw = function (text, id) {
const element = d3.select('#' + id + ' g'); const element = d3.select('#' + id + ' g');
render(element, g); render(element, g);
element.selectAll('g.node').attr('title', function () { element.selectAll('g.node').attr('title', function() {
return flowDb.getTooltip(this.id); return flowDb.getTooltip(this.id);
}); });
@@ -414,7 +414,10 @@ export const draw = function (text, id) {
const svgBounds = svg.node().getBBox(); const svgBounds = svg.node().getBBox();
const width = svgBounds.width + padding * 2; const width = svgBounds.width + padding * 2;
const height = svgBounds.height + padding * 2; const height = svgBounds.height + padding * 2;
logger.debug(`new ViewBox 0 0 ${width} ${height}`, `translate(${padding - g._label.marginx}, ${padding - g._label.marginy})`); logger.debug(
`new ViewBox 0 0 ${width} ${height}`,
`translate(${padding - g._label.marginx}, ${padding - g._label.marginy})`
);
if (conf.useMaxWidth) { if (conf.useMaxWidth) {
svg.attr('width', '100%'); svg.attr('width', '100%');
@@ -425,9 +428,10 @@ export const draw = function (text, id) {
} }
svg.attr('viewBox', `0 0 ${width} ${height}`); svg.attr('viewBox', `0 0 ${width} ${height}`);
svg.select('g').attr('transform', `translate(${padding - g._label.marginx}, ${padding - svgBounds.y})`); svg
.select('g')
} else { .attr('transform', `translate(${padding - g._label.marginx}, ${padding - svgBounds.y})`);
} else {
const width = g.maxX - g.minX + padding * 2; const width = g.maxX - g.minX + padding * 2;
const height = g.maxY - g.minY + padding * 2; const height = g.maxY - g.minY + padding * 2;
@@ -439,12 +443,15 @@ export const draw = function (text, id) {
svg.attr('width', width); svg.attr('width', width);
} }
logger.debug(`Org ViewBox 0 0 ${width} ${height}`, `translate(${padding - g.minX}, ${padding - g.minY})\n${location.href}`) logger.debug(
`Org ViewBox 0 0 ${width} ${height}`,
`translate(${padding - g.minX}, ${padding - g.minY})\n${location.href}`
);
svg.attr('viewBox', `0 0 ${width} ${height}`); svg.attr('viewBox', `0 0 ${width} ${height}`);
svg.select('g').attr('transform', `translate(${padding - g.minX}, ${padding - g.minY})`); svg.select('g').attr('transform', `translate(${padding - g.minX}, ${padding - g.minY})`);
// svg.select('g').attr('transform', `translate(${padding - minX}, ${padding - minY})`); // svg.select('g').attr('transform', `translate(${padding - minX}, ${padding - minY})`);
} }
// Index nodes // Index nodes
flowDb.indexNodes('subGraph' + i); flowDb.indexNodes('subGraph' + i);