mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-02-04 07:13:25 +08:00
Merge pull request #1032 from knsv/bug/1031_stricter_code_checks
Fix for Bug/1031 stricter code checks
This commit is contained in:
commit
e550d974da
1
.eslintignore
Normal file
1
.eslintignore
Normal file
@ -0,0 +1 @@
|
|||||||
|
**/*.spec.js
|
@ -1,7 +1,8 @@
|
|||||||
{
|
{
|
||||||
"env": {
|
"env": {
|
||||||
"browser": true,
|
"browser": true,
|
||||||
"es6": true
|
"es6": true,
|
||||||
|
"node": true
|
||||||
},
|
},
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaFeatures": {
|
"ecmaFeatures": {
|
||||||
@ -10,7 +11,7 @@
|
|||||||
},
|
},
|
||||||
"sourceType": "module"
|
"sourceType": "module"
|
||||||
},
|
},
|
||||||
"extends": ["prettier"],
|
"extends": ["prettier", "eslint:recommended"],
|
||||||
"plugins": ["prettier"],
|
"plugins": ["prettier"],
|
||||||
"rules": {
|
"rules": {
|
||||||
"prettier/prettier": ["error"]
|
"prettier/prettier": ["error"]
|
||||||
|
33
cypress/integration/rendering/current.spec.js
Normal file
33
cypress/integration/rendering/current.spec.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/* eslint-env jest */
|
||||||
|
import { imgSnapshotTest } from '../../helpers/util';
|
||||||
|
|
||||||
|
describe('State diagram', () => {
|
||||||
|
it('should render a flowchart full of circles', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
graph LR
|
||||||
|
47(SAM.CommonFA.FMESummary)-->48(SAM.CommonFA.CommonFAFinanceBudget)
|
||||||
|
37(SAM.CommonFA.BudgetSubserviceLineVolume)-->48(SAM.CommonFA.CommonFAFinanceBudget)
|
||||||
|
35(SAM.CommonFA.PopulationFME)-->47(SAM.CommonFA.FMESummary)
|
||||||
|
41(SAM.CommonFA.MetricCost)-->47(SAM.CommonFA.FMESummary)
|
||||||
|
44(SAM.CommonFA.MetricOutliers)-->47(SAM.CommonFA.FMESummary)
|
||||||
|
46(SAM.CommonFA.MetricOpportunity)-->47(SAM.CommonFA.FMESummary)
|
||||||
|
40(SAM.CommonFA.OPVisits)-->47(SAM.CommonFA.FMESummary)
|
||||||
|
38(SAM.CommonFA.CommonFAFinanceRefund)-->47(SAM.CommonFA.FMESummary)
|
||||||
|
43(SAM.CommonFA.CommonFAFinancePicuDays)-->47(SAM.CommonFA.FMESummary)
|
||||||
|
42(SAM.CommonFA.CommonFAFinanceNurseryDays)-->47(SAM.CommonFA.FMESummary)
|
||||||
|
45(SAM.CommonFA.MetricPreOpportunity)-->46(SAM.CommonFA.MetricOpportunity)
|
||||||
|
35(SAM.CommonFA.PopulationFME)-->45(SAM.CommonFA.MetricPreOpportunity)
|
||||||
|
41(SAM.CommonFA.MetricCost)-->45(SAM.CommonFA.MetricPreOpportunity)
|
||||||
|
41(SAM.CommonFA.MetricCost)-->44(SAM.CommonFA.MetricOutliers)
|
||||||
|
39(SAM.CommonFA.ChargeDetails)-->43(SAM.CommonFA.CommonFAFinancePicuDays)
|
||||||
|
39(SAM.CommonFA.ChargeDetails)-->42(SAM.CommonFA.CommonFAFinanceNurseryDays)
|
||||||
|
39(SAM.CommonFA.ChargeDetails)-->41(SAM.CommonFA.MetricCost)
|
||||||
|
39(SAM.CommonFA.ChargeDetails)-->40(SAM.CommonFA.OPVisits)
|
||||||
|
35(SAM.CommonFA.PopulationFME)-->39(SAM.CommonFA.ChargeDetails)
|
||||||
|
36(SAM.CommonFA.PremetricCost)-->39(SAM.CommonFA.ChargeDetails)
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
@ -204,14 +204,12 @@ const drawEdge = function(elem, path, relation) {
|
|||||||
x = labalPosition.x;
|
x = labalPosition.x;
|
||||||
y = labalPosition.y;
|
y = labalPosition.y;
|
||||||
|
|
||||||
let p1_card_x,
|
let p1_card_x, p1_card_y;
|
||||||
p1_card_y,
|
// p1_card_padd_x = conf.padding * 2,
|
||||||
p1_card_padd_x = conf.padding * 2,
|
// p1_card_padd_y = conf.padding;
|
||||||
p1_card_padd_y = conf.padding;
|
let p2_card_x, p2_card_y;
|
||||||
let p2_card_x,
|
// p2_card_padd_x = conf.padding * 2,
|
||||||
p2_card_y,
|
// p2_card_padd_y = -conf.padding / 2;
|
||||||
p2_card_padd_x = conf.padding * 2,
|
|
||||||
p2_card_padd_y = -conf.padding / 2;
|
|
||||||
if (l % 2 !== 0 && l > 1) {
|
if (l % 2 !== 0 && l > 1) {
|
||||||
let cardinality_1_point = utils.calcCardinalityPosition(
|
let cardinality_1_point = utils.calcCardinalityPosition(
|
||||||
relation.relation.type1 !== 'none',
|
relation.relation.type1 !== 'none',
|
||||||
@ -258,8 +256,7 @@ const drawEdge = function(elem, path, relation) {
|
|||||||
logger.info('Rendering relation ' + JSON.stringify(relation));
|
logger.info('Rendering relation ' + JSON.stringify(relation));
|
||||||
if (typeof relation.relationTitle1 !== 'undefined' && relation.relationTitle1 !== 'none') {
|
if (typeof relation.relationTitle1 !== 'undefined' && relation.relationTitle1 !== 'none') {
|
||||||
const g = elem.append('g').attr('class', 'cardinality');
|
const g = elem.append('g').attr('class', 'cardinality');
|
||||||
const label = g
|
g.append('text')
|
||||||
.append('text')
|
|
||||||
.attr('class', 'type1')
|
.attr('class', 'type1')
|
||||||
.attr('x', p1_card_x)
|
.attr('x', p1_card_x)
|
||||||
.attr('y', p1_card_y)
|
.attr('y', p1_card_y)
|
||||||
@ -269,8 +266,7 @@ const drawEdge = function(elem, path, relation) {
|
|||||||
}
|
}
|
||||||
if (typeof relation.relationTitle2 !== 'undefined' && relation.relationTitle2 !== 'none') {
|
if (typeof relation.relationTitle2 !== 'undefined' && relation.relationTitle2 !== 'none') {
|
||||||
const g = elem.append('g').attr('class', 'cardinality');
|
const g = elem.append('g').attr('class', 'cardinality');
|
||||||
const label = g
|
g.append('text')
|
||||||
.append('text')
|
|
||||||
.attr('class', 'type2')
|
.attr('class', 'type2')
|
||||||
.attr('x', p2_card_x)
|
.attr('x', p2_card_x)
|
||||||
.attr('y', p2_card_y)
|
.attr('y', p2_card_y)
|
||||||
|
@ -223,7 +223,7 @@ const setClickFun = function(_id, functionName) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (typeof vertices[id] !== 'undefined') {
|
if (typeof vertices[id] !== 'undefined') {
|
||||||
funs.push(function(element) {
|
funs.push(function() {
|
||||||
const elem = document.querySelector(`[id="${id}"]`);
|
const elem = document.querySelector(`[id="${id}"]`);
|
||||||
if (elem !== null) {
|
if (elem !== null) {
|
||||||
elem.addEventListener(
|
elem.addEventListener(
|
||||||
@ -395,7 +395,7 @@ export const addSubGraph = function(_id, list, _title) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (type in prims) {
|
if (type in prims) {
|
||||||
return prims[type].hasOwnProperty(item) ? false : (prims[type][item] = true);
|
return prims[type].hasOwnProperty(item) ? false : (prims[type][item] = true); // eslint-disable-line
|
||||||
} else {
|
} else {
|
||||||
return objs.indexOf(item) >= 0 ? false : objs.push(item);
|
return objs.indexOf(item) >= 0 ? false : objs.push(item);
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,7 @@ export const draw = function(text, id) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Override normal arrowhead defined in d3. Remove style & add class to allow css styling.
|
// Override normal arrowhead defined in d3. Remove style & add class to allow css styling.
|
||||||
render.arrows().normal = function normal(parent, id, edge, type) {
|
render.arrows().normal = function normal(parent, id) {
|
||||||
const marker = parent
|
const marker = parent
|
||||||
.append('marker')
|
.append('marker')
|
||||||
.attr('id', id)
|
.attr('id', id)
|
||||||
|
@ -387,10 +387,11 @@ const compileTasks = function() {
|
|||||||
const task = rawTasks[pos];
|
const task = rawTasks[pos];
|
||||||
let startTime = '';
|
let startTime = '';
|
||||||
switch (rawTasks[pos].raw.startTime.type) {
|
switch (rawTasks[pos].raw.startTime.type) {
|
||||||
case 'prevTaskEnd':
|
case 'prevTaskEnd': {
|
||||||
const prevTask = findTaskById(task.prevTaskId);
|
const prevTask = findTaskById(task.prevTaskId);
|
||||||
task.startTime = prevTask.endTime;
|
task.startTime = prevTask.endTime;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 'getStartDate':
|
case 'getStartDate':
|
||||||
startTime = getStartDate(undefined, dateFormat, rawTasks[pos].raw.startTime.startData);
|
startTime = getStartDate(undefined, dateFormat, rawTasks[pos].raw.startTime.startData);
|
||||||
if (startTime) {
|
if (startTime) {
|
||||||
@ -501,7 +502,7 @@ const setClickFun = function(id, functionName, functionArgs) {
|
|||||||
* @param callbackFunction A function to be executed when clicked on the task or the task's text
|
* @param callbackFunction A function to be executed when clicked on the task or the task's text
|
||||||
*/
|
*/
|
||||||
const pushFun = function(id, callbackFunction) {
|
const pushFun = function(id, callbackFunction) {
|
||||||
funs.push(function(element) {
|
funs.push(function() {
|
||||||
// const elem = d3.select(element).select(`[id="${id}"]`)
|
// const elem = d3.select(element).select(`[id="${id}"]`)
|
||||||
const elem = document.querySelector(`[id="${id}"]`);
|
const elem = document.querySelector(`[id="${id}"]`);
|
||||||
if (elem !== null) {
|
if (elem !== null) {
|
||||||
@ -510,7 +511,7 @@ const pushFun = function(id, callbackFunction) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
funs.push(function(element) {
|
funs.push(function() {
|
||||||
// const elem = d3.select(element).select(`[id="${id}-text"]`)
|
// const elem = d3.select(element).select(`[id="${id}-text"]`)
|
||||||
const elem = document.querySelector(`[id="${id}-text"]`);
|
const elem = document.querySelector(`[id="${id}-text"]`);
|
||||||
if (elem !== null) {
|
if (elem !== null) {
|
||||||
|
@ -102,7 +102,7 @@ export const draw = function(text, id) {
|
|||||||
drawToday(leftPadding, topPadding, pageWidth, pageHeight);
|
drawToday(leftPadding, topPadding, pageWidth, pageHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawRects(theArray, theGap, theTopPad, theSidePad, theBarHeight, theColorScale, w, h) {
|
function drawRects(theArray, theGap, theTopPad, theSidePad, theBarHeight, theColorScale, w) {
|
||||||
// Draw background rects covering the entire width of the graph, these form the section rows.
|
// Draw background rects covering the entire width of the graph, these form the section rows.
|
||||||
svg
|
svg
|
||||||
.append('g')
|
.append('g')
|
||||||
@ -401,7 +401,7 @@ export const draw = function(text, id) {
|
|||||||
const hash = {};
|
const hash = {};
|
||||||
const result = [];
|
const result = [];
|
||||||
for (let i = 0, l = arr.length; i < l; ++i) {
|
for (let i = 0, l = arr.length; i < l; ++i) {
|
||||||
if (!hash.hasOwnProperty(arr[i])) {
|
if (!hash.hasOwnProperty(arr[i])) { // eslint-disable-line
|
||||||
// it works with objects! in FF, at least
|
// it works with objects! in FF, at least
|
||||||
hash[arr[i]] = true;
|
hash[arr[i]] = true;
|
||||||
result.push(arr[i]);
|
result.push(arr[i]);
|
||||||
|
@ -21,7 +21,7 @@ export const setConf = function(cnf) {
|
|||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
let w;
|
let w;
|
||||||
export const draw = (txt, id, ver) => {
|
export const draw = (txt, id) => {
|
||||||
try {
|
try {
|
||||||
const parser = pieParser.parser;
|
const parser = pieParser.parser;
|
||||||
parser.yy = pieData;
|
parser.yy = pieData;
|
||||||
|
@ -514,11 +514,12 @@ export const draw = function(text, id) {
|
|||||||
bounds.newLoop(undefined, msg.message);
|
bounds.newLoop(undefined, msg.message);
|
||||||
bounds.bumpVerticalPos(conf.boxMargin);
|
bounds.bumpVerticalPos(conf.boxMargin);
|
||||||
break;
|
break;
|
||||||
case parser.yy.LINETYPE.RECT_END:
|
case parser.yy.LINETYPE.RECT_END: {
|
||||||
const rectData = bounds.endLoop();
|
const rectData = bounds.endLoop();
|
||||||
svgDraw.drawBackgroundRect(diagram, rectData);
|
svgDraw.drawBackgroundRect(diagram, rectData);
|
||||||
bounds.bumpVerticalPos(conf.boxMargin);
|
bounds.bumpVerticalPos(conf.boxMargin);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case parser.yy.LINETYPE.OPT_START:
|
case parser.yy.LINETYPE.OPT_START:
|
||||||
bounds.bumpVerticalPos(conf.boxMargin);
|
bounds.bumpVerticalPos(conf.boxMargin);
|
||||||
bounds.newLoop(msg.message);
|
bounds.newLoop(msg.message);
|
||||||
|
@ -16,7 +16,7 @@ export const drawRect = function(elem, rectData) {
|
|||||||
return rectElem;
|
return rectElem;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const drawText = function(elem, textData, width) {
|
export const drawText = function(elem, textData) {
|
||||||
// Remove and ignore br:s
|
// Remove and ignore br:s
|
||||||
const nText = textData.text.replace(/<br\/?>/gi, ' ');
|
const nText = textData.text.replace(/<br\/?>/gi, ' ');
|
||||||
|
|
||||||
@ -374,7 +374,7 @@ const _drawTextCandidateFunc = (function() {
|
|||||||
|
|
||||||
function _setTextAttrs(toText, fromTextAttrsDict) {
|
function _setTextAttrs(toText, fromTextAttrsDict) {
|
||||||
for (const key in fromTextAttrsDict) {
|
for (const key in fromTextAttrsDict) {
|
||||||
if (fromTextAttrsDict.hasOwnProperty(key)) {
|
if (fromTextAttrsDict.hasOwnProperty(key)) { // eslint-disable-line
|
||||||
toText.attr(key, fromTextAttrsDict[key]);
|
toText.attr(key, fromTextAttrsDict[key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ import * as d3 from 'd3';
|
|||||||
import idCache from './id-cache.js';
|
import idCache from './id-cache.js';
|
||||||
import stateDb from './stateDb';
|
import stateDb from './stateDb';
|
||||||
import utils from '../../utils';
|
import utils from '../../utils';
|
||||||
import { getConfig, conf } from '../../config';
|
import { getConfig } from '../../config';
|
||||||
|
|
||||||
// let conf;
|
// let conf;
|
||||||
|
|
||||||
@ -131,15 +131,15 @@ export const drawDescrState = (g, stateDef) => {
|
|||||||
*/
|
*/
|
||||||
export const addIdAndBox = (g, stateDef) => {
|
export const addIdAndBox = (g, stateDef) => {
|
||||||
// TODO Move hardcodings to conf
|
// TODO Move hardcodings to conf
|
||||||
const addTspan = function(textEl, txt, isFirst) {
|
// const addTspan = function(textEl, txt, isFirst) {
|
||||||
const tSpan = textEl
|
// const tSpan = textEl
|
||||||
.append('tspan')
|
// .append('tspan')
|
||||||
.attr('x', 2 * getConfig().state.padding)
|
// .attr('x', 2 * getConfig().state.padding)
|
||||||
.text(txt);
|
// .text(txt);
|
||||||
if (!isFirst) {
|
// if (!isFirst) {
|
||||||
tSpan.attr('dy', getConfig().state.textHeight);
|
// tSpan.attr('dy', getConfig().state.textHeight);
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
const title = g
|
const title = g
|
||||||
.append('text')
|
.append('text')
|
||||||
.attr('x', 2 * getConfig().state.padding)
|
.attr('x', 2 * getConfig().state.padding)
|
||||||
@ -148,7 +148,7 @@ export const addIdAndBox = (g, stateDef) => {
|
|||||||
.attr('class', 'state-title')
|
.attr('class', 'state-title')
|
||||||
.text(stateDef.id);
|
.text(stateDef.id);
|
||||||
|
|
||||||
const titleHeight = title.node().getBBox().height;
|
const titleBox = title.node().getBBox();
|
||||||
|
|
||||||
const lineY = 1 - getConfig().state.textHeight;
|
const lineY = 1 - getConfig().state.textHeight;
|
||||||
const descrLine = g
|
const descrLine = g
|
||||||
@ -159,7 +159,7 @@ export const addIdAndBox = (g, stateDef) => {
|
|||||||
.attr('class', 'descr-divider');
|
.attr('class', 'descr-divider');
|
||||||
|
|
||||||
const graphBox = g.node().getBBox();
|
const graphBox = g.node().getBBox();
|
||||||
title.attr('x', graphBox.width / 2 - title.node().getBBox().width / 2);
|
title.attr('x', graphBox.width / 2 - titleBox.width / 2);
|
||||||
descrLine.attr('x2', graphBox.width + getConfig().state.padding);
|
descrLine.attr('x2', graphBox.width + getConfig().state.padding);
|
||||||
|
|
||||||
// White color
|
// White color
|
||||||
@ -241,7 +241,7 @@ const drawForkJoinState = (g, stateDef) => {
|
|||||||
.attr('y', getConfig().state.padding);
|
.attr('y', getConfig().state.padding);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const drawText = function(elem, textData, width) {
|
export const drawText = function(elem, textData) {
|
||||||
// Remove and ignore br:s
|
// Remove and ignore br:s
|
||||||
const nText = textData.text.replace(/<br\/?>/gi, ' ');
|
const nText = textData.text.replace(/<br\/?>/gi, ' ');
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ export const drawText = function(elem, textData, width) {
|
|||||||
|
|
||||||
const _drawLongText = (_text, x, y, g) => {
|
const _drawLongText = (_text, x, y, g) => {
|
||||||
let textHeight = 0;
|
let textHeight = 0;
|
||||||
let textWidth = 0;
|
|
||||||
const textElem = g.append('text');
|
const textElem = g.append('text');
|
||||||
textElem.style('text-anchor', 'start');
|
textElem.style('text-anchor', 'start');
|
||||||
textElem.attr('class', 'noteText');
|
textElem.attr('class', 'noteText');
|
||||||
@ -317,8 +317,7 @@ export const drawNote = (text, g) => {
|
|||||||
* @param {*} stateDef
|
* @param {*} stateDef
|
||||||
*/
|
*/
|
||||||
|
|
||||||
let cnt = 0;
|
export const drawState = function(elem, stateDef) {
|
||||||
export const drawState = function(elem, stateDef, graph, doc) {
|
|
||||||
const id = stateDef.id;
|
const id = stateDef.id;
|
||||||
const stateInfo = {
|
const stateInfo = {
|
||||||
id: id,
|
id: id,
|
||||||
|
@ -9,7 +9,7 @@ const setRootDoc = o => {
|
|||||||
const getRootDoc = () => rootDoc;
|
const getRootDoc = () => rootDoc;
|
||||||
|
|
||||||
const extract = doc => {
|
const extract = doc => {
|
||||||
const res = { states: [], relations: [] };
|
// const res = { states: [], relations: [] };
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
doc.forEach(item => {
|
doc.forEach(item => {
|
||||||
@ -37,8 +37,8 @@ let documents = {
|
|||||||
let currentDocument = documents.root;
|
let currentDocument = documents.root;
|
||||||
|
|
||||||
let startCnt = 0;
|
let startCnt = 0;
|
||||||
let endCnt = 0;
|
let endCnt = 0; // eslint-disable-line
|
||||||
let stateCnt = 0;
|
// let stateCnt = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function called by parser when a node definition has been found.
|
* Function called by parser when a node definition has been found.
|
||||||
|
@ -4,15 +4,12 @@ import graphlib from 'graphlib';
|
|||||||
import { logger } from '../../logger';
|
import { logger } from '../../logger';
|
||||||
import stateDb from './stateDb';
|
import stateDb from './stateDb';
|
||||||
import { parser } from './parser/stateDiagram';
|
import { parser } from './parser/stateDiagram';
|
||||||
import utils from '../../utils';
|
// import idCache from './id-cache';
|
||||||
import idCache from './id-cache';
|
import { drawState, addIdAndBox, drawEdge } from './shapes';
|
||||||
import { drawState, addIdAndBox, drawEdge, drawNote } from './shapes';
|
|
||||||
import { getConfig } from '../../config';
|
import { getConfig } from '../../config';
|
||||||
|
|
||||||
parser.yy = stateDb;
|
parser.yy = stateDb;
|
||||||
|
|
||||||
let total = 0;
|
|
||||||
|
|
||||||
// TODO Move conf object to main conf in mermaidAPI
|
// TODO Move conf object to main conf in mermaidAPI
|
||||||
let conf;
|
let conf;
|
||||||
// {
|
// {
|
||||||
@ -28,20 +25,20 @@ let conf;
|
|||||||
|
|
||||||
const transformationLog = {};
|
const transformationLog = {};
|
||||||
|
|
||||||
export const setConf = function(cnf) {};
|
export const setConf = function() {};
|
||||||
|
|
||||||
// Todo optimize
|
// Todo optimize
|
||||||
const getGraphId = function(label) {
|
// const getGraphId = function(label) {
|
||||||
const keys = idCache.keys();
|
// const keys = idCache.keys();
|
||||||
|
|
||||||
for (let i = 0; i < keys.length; i++) {
|
// for (let i = 0; i < keys.length; i++) {
|
||||||
if (idCache.get(keys[i]).label === label) {
|
// if (idCache.get(keys[i]).label === label) {
|
||||||
return keys[i];
|
// return keys[i];
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
return undefined;
|
// return undefined;
|
||||||
};
|
// };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup arrow head and define the marker. The result is appended to the svg.
|
* Setup arrow head and define the marker. The result is appended to the svg.
|
||||||
@ -90,7 +87,7 @@ export const draw = function(text, id) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const rootDoc = stateDb.getRootDoc();
|
const rootDoc = stateDb.getRootDoc();
|
||||||
const n = renderDoc(rootDoc, diagram);
|
renderDoc(rootDoc, diagram);
|
||||||
|
|
||||||
const bounds = diagram.node().getBBox();
|
const bounds = diagram.node().getBBox();
|
||||||
|
|
||||||
@ -129,7 +126,6 @@ const renderDoc = (doc, diagram, parentId) => {
|
|||||||
// multigraph: false,
|
// multigraph: false,
|
||||||
compound: true,
|
compound: true,
|
||||||
// acyclicer: 'greedy',
|
// acyclicer: 'greedy',
|
||||||
rankdir: 'LR',
|
|
||||||
ranker: 'tight-tree',
|
ranker: 'tight-tree',
|
||||||
ranksep: conf.edgeLengthFactor
|
ranksep: conf.edgeLengthFactor
|
||||||
// isMultiGraph: false
|
// isMultiGraph: false
|
||||||
@ -159,7 +155,6 @@ const renderDoc = (doc, diagram, parentId) => {
|
|||||||
|
|
||||||
const keys = Object.keys(states);
|
const keys = Object.keys(states);
|
||||||
|
|
||||||
total = keys.length;
|
|
||||||
let first = true;
|
let first = true;
|
||||||
|
|
||||||
for (let i = 0; i < keys.length; i++) {
|
for (let i = 0; i < keys.length; i++) {
|
||||||
|
@ -317,7 +317,6 @@ const config = {
|
|||||||
forkWidth: 70,
|
forkWidth: 70,
|
||||||
forkHeight: 7,
|
forkHeight: 7,
|
||||||
// Used
|
// Used
|
||||||
padding: 5,
|
|
||||||
miniPadding: 2,
|
miniPadding: 2,
|
||||||
// Font size factor, this is used to guess the width of the edges labels before rendering by dagre
|
// Font size factor, this is used to guess the width of the edges labels before rendering by dagre
|
||||||
// layout. This might need updating if/when switching font
|
// layout. This might need updating if/when switching font
|
||||||
|
@ -122,7 +122,7 @@ const calcLabelPosition = points => {
|
|||||||
|
|
||||||
const calcCardinalityPosition = (isRelationTypePresent, points, initialPosition) => {
|
const calcCardinalityPosition = (isRelationTypePresent, points, initialPosition) => {
|
||||||
let prevPoint;
|
let prevPoint;
|
||||||
let totalDistance = 0;
|
let totalDistance = 0; // eslint-disable-line
|
||||||
if (points[0] !== initialPosition) {
|
if (points[0] !== initialPosition) {
|
||||||
points = points.reverse();
|
points = points.reverse();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user