2019-10-05 09:02:20 +02:00
|
|
|
import * as d3 from 'd3';
|
|
|
|
import idCache from './id-cache.js';
|
|
|
|
import stateDb from './stateDb';
|
2019-10-05 10:02:58 +02:00
|
|
|
import utils from '../../utils';
|
2019-10-11 15:39:50 +02:00
|
|
|
import { getConfig, conf } from '../../config';
|
2019-10-05 09:02:20 +02:00
|
|
|
|
2019-10-11 15:39:50 +02:00
|
|
|
// let conf;
|
2019-10-05 09:02:20 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Draws a start state as a black circle
|
|
|
|
*/
|
|
|
|
export const drawStartState = g =>
|
|
|
|
g
|
|
|
|
.append('circle')
|
|
|
|
.style('stroke', 'black')
|
|
|
|
.style('fill', 'black')
|
2019-10-11 15:39:50 +02:00
|
|
|
.attr('r', getConfig().state.sizeUnit)
|
|
|
|
.attr('cx', getConfig().state.padding + getConfig().state.sizeUnit)
|
|
|
|
.attr('cy', getConfig().state.padding + getConfig().state.sizeUnit);
|
2019-10-05 09:02:20 +02:00
|
|
|
|
2019-10-06 15:44:31 +02:00
|
|
|
/**
|
|
|
|
* Draws a start state as a black circle
|
|
|
|
*/
|
|
|
|
export const drawDivider = g =>
|
|
|
|
g
|
|
|
|
.append('line')
|
|
|
|
.style('stroke', 'grey')
|
|
|
|
.style('stroke-dasharray', '3')
|
2019-10-11 15:39:50 +02:00
|
|
|
.attr('x1', getConfig().state.textHeight)
|
2019-10-06 15:44:31 +02:00
|
|
|
.attr('class', 'divider')
|
2019-10-11 15:39:50 +02:00
|
|
|
.attr('x2', getConfig().state.textHeight * 2)
|
2019-10-06 15:53:34 +02:00
|
|
|
.attr('y1', 0)
|
|
|
|
.attr('y2', 0);
|
2019-10-06 15:44:31 +02:00
|
|
|
|
2019-10-05 09:02:20 +02:00
|
|
|
/**
|
|
|
|
* Draws a an end state as a black circle
|
|
|
|
*/
|
|
|
|
export const drawSimpleState = (g, stateDef) => {
|
|
|
|
const state = g
|
|
|
|
.append('text')
|
2019-10-11 15:39:50 +02:00
|
|
|
.attr('x', 2 * getConfig().state.padding)
|
|
|
|
.attr('y', getConfig().state.textHeight + 2 * getConfig().state.padding)
|
|
|
|
.attr('font-size', getConfig().state.fontSize)
|
2019-10-11 18:12:24 +02:00
|
|
|
.attr('class', 'state-title')
|
2019-10-05 09:02:20 +02:00
|
|
|
.text(stateDef.id);
|
|
|
|
|
|
|
|
const classBox = state.node().getBBox();
|
|
|
|
g.insert('rect', ':first-child')
|
2019-10-11 15:39:50 +02:00
|
|
|
.attr('x', getConfig().state.padding)
|
|
|
|
.attr('y', getConfig().state.padding)
|
|
|
|
.attr('width', classBox.width + 2 * getConfig().state.padding)
|
|
|
|
.attr('height', classBox.height + 2 * getConfig().state.padding)
|
|
|
|
.attr('rx', getConfig().state.radius);
|
2019-10-05 09:02:20 +02:00
|
|
|
|
|
|
|
return state;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Draws a state with descriptions
|
|
|
|
* @param {*} g
|
|
|
|
* @param {*} stateDef
|
|
|
|
*/
|
|
|
|
export const drawDescrState = (g, stateDef) => {
|
|
|
|
const addTspan = function(textEl, txt, isFirst) {
|
|
|
|
const tSpan = textEl
|
|
|
|
.append('tspan')
|
2019-10-11 15:39:50 +02:00
|
|
|
.attr('x', 2 * getConfig().state.padding)
|
2019-10-05 09:02:20 +02:00
|
|
|
.text(txt);
|
|
|
|
if (!isFirst) {
|
2019-10-11 15:39:50 +02:00
|
|
|
tSpan.attr('dy', getConfig().state.textHeight);
|
2019-10-05 09:02:20 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
const title = g
|
|
|
|
.append('text')
|
2019-10-11 15:39:50 +02:00
|
|
|
.attr('x', 2 * getConfig().state.padding)
|
|
|
|
.attr('y', getConfig().state.textHeight + 1.5 * getConfig().state.padding)
|
|
|
|
.attr('font-size', getConfig().state.fontSize)
|
2019-10-05 09:02:20 +02:00
|
|
|
.attr('class', 'state-title')
|
2019-10-23 19:22:36 +02:00
|
|
|
.text(stateDef.descriptions[0]);
|
2019-10-05 09:02:20 +02:00
|
|
|
|
2019-10-09 20:05:24 +02:00
|
|
|
const titleBox = title.node().getBBox();
|
|
|
|
const titleHeight = titleBox.height;
|
2019-10-05 09:02:20 +02:00
|
|
|
|
|
|
|
const description = g
|
|
|
|
.append('text') // text label for the x axis
|
2019-10-11 15:39:50 +02:00
|
|
|
.attr('x', getConfig().state.padding)
|
|
|
|
.attr(
|
|
|
|
'y',
|
|
|
|
titleHeight +
|
|
|
|
getConfig().state.padding * 0.2 +
|
|
|
|
getConfig().state.dividerMargin +
|
|
|
|
getConfig().state.textHeight
|
|
|
|
)
|
2019-10-05 09:02:20 +02:00
|
|
|
.attr('class', 'state-description');
|
|
|
|
|
|
|
|
let isFirst = true;
|
2019-10-23 19:22:36 +02:00
|
|
|
let isSecond = true;
|
2019-10-05 09:02:20 +02:00
|
|
|
stateDef.descriptions.forEach(function(descr) {
|
2019-10-23 19:22:36 +02:00
|
|
|
if (!isFirst) {
|
|
|
|
addTspan(description, descr, isSecond);
|
|
|
|
isSecond = false;
|
|
|
|
}
|
2019-10-05 09:02:20 +02:00
|
|
|
isFirst = false;
|
|
|
|
});
|
|
|
|
|
|
|
|
const descrLine = g
|
|
|
|
.append('line') // text label for the x axis
|
2019-10-11 15:39:50 +02:00
|
|
|
.attr('x1', getConfig().state.padding)
|
|
|
|
.attr('y1', getConfig().state.padding + titleHeight + getConfig().state.dividerMargin / 2)
|
|
|
|
.attr('y2', getConfig().state.padding + titleHeight + getConfig().state.dividerMargin / 2)
|
2019-10-05 09:02:20 +02:00
|
|
|
.attr('class', 'descr-divider');
|
|
|
|
const descrBox = description.node().getBBox();
|
2019-10-09 20:05:24 +02:00
|
|
|
const width = Math.max(descrBox.width, titleBox.width);
|
|
|
|
|
2019-10-11 15:39:50 +02:00
|
|
|
descrLine.attr('x2', width + 3 * getConfig().state.padding);
|
2019-10-05 09:02:20 +02:00
|
|
|
// const classBox = title.node().getBBox();
|
|
|
|
|
|
|
|
g.insert('rect', ':first-child')
|
2019-10-11 15:39:50 +02:00
|
|
|
.attr('x', getConfig().state.padding)
|
|
|
|
.attr('y', getConfig().state.padding)
|
|
|
|
.attr('width', width + 2 * getConfig().state.padding)
|
|
|
|
.attr('height', descrBox.height + titleHeight + 2 * getConfig().state.padding)
|
|
|
|
.attr('rx', getConfig().state.radius);
|
2019-10-05 09:02:20 +02:00
|
|
|
|
|
|
|
return g;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds the creates a box around the existing content and adds a
|
|
|
|
* panel for the id on top of the content.
|
|
|
|
*/
|
|
|
|
export const addIdAndBox = (g, stateDef) => {
|
|
|
|
// TODO Move hardcodings to conf
|
|
|
|
const addTspan = function(textEl, txt, isFirst) {
|
|
|
|
const tSpan = textEl
|
|
|
|
.append('tspan')
|
2019-10-11 15:39:50 +02:00
|
|
|
.attr('x', 2 * getConfig().state.padding)
|
2019-10-05 09:02:20 +02:00
|
|
|
.text(txt);
|
|
|
|
if (!isFirst) {
|
2019-10-11 15:39:50 +02:00
|
|
|
tSpan.attr('dy', getConfig().state.textHeight);
|
2019-10-05 09:02:20 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
const title = g
|
|
|
|
.append('text')
|
2019-10-11 15:39:50 +02:00
|
|
|
.attr('x', 2 * getConfig().state.padding)
|
|
|
|
.attr('y', getConfig().state.titleShift)
|
|
|
|
.attr('font-size', getConfig().state.fontSize)
|
2019-10-05 09:02:20 +02:00
|
|
|
.attr('class', 'state-title')
|
|
|
|
.text(stateDef.id);
|
|
|
|
|
|
|
|
const titleHeight = title.node().getBBox().height;
|
|
|
|
|
2019-10-11 15:39:50 +02:00
|
|
|
const lineY = 1 - getConfig().state.textHeight;
|
2019-10-05 09:02:20 +02:00
|
|
|
const descrLine = g
|
|
|
|
.append('line') // text label for the x axis
|
|
|
|
.attr('x1', 0)
|
|
|
|
.attr('y1', lineY)
|
|
|
|
.attr('y2', lineY)
|
|
|
|
.attr('class', 'descr-divider');
|
|
|
|
|
|
|
|
const graphBox = g.node().getBBox();
|
|
|
|
title.attr('x', graphBox.width / 2 - title.node().getBBox().width / 2);
|
2019-10-11 15:39:50 +02:00
|
|
|
descrLine.attr('x2', graphBox.width + getConfig().state.padding);
|
2019-10-05 09:02:20 +02:00
|
|
|
|
2019-10-10 17:57:29 +02:00
|
|
|
// White color
|
|
|
|
g.insert('rect', ':first-child')
|
|
|
|
.attr('x', graphBox.x)
|
|
|
|
.attr('y', lineY)
|
2019-10-11 18:12:24 +02:00
|
|
|
.attr('class', 'composit')
|
2019-10-11 15:39:50 +02:00
|
|
|
.attr('width', graphBox.width + getConfig().state.padding)
|
|
|
|
.attr(
|
|
|
|
'height',
|
|
|
|
graphBox.height + getConfig().state.textHeight + getConfig().state.titleShift + 1
|
|
|
|
)
|
2019-10-10 17:57:29 +02:00
|
|
|
.attr('rx', '0');
|
|
|
|
|
|
|
|
// Title background
|
2019-10-05 09:02:20 +02:00
|
|
|
g.insert('rect', ':first-child')
|
|
|
|
.attr('x', graphBox.x)
|
2019-10-11 15:39:50 +02:00
|
|
|
.attr(
|
|
|
|
'y',
|
|
|
|
getConfig().state.titleShift - getConfig().state.textHeight - getConfig().state.padding
|
|
|
|
)
|
|
|
|
.attr('width', graphBox.width + getConfig().state.padding)
|
|
|
|
// Just needs to be higher then the descr line, will be clipped by the white color box
|
|
|
|
.attr('height', getConfig().state.textHeight * 3)
|
|
|
|
.attr('rx', getConfig().state.radius);
|
2019-10-10 17:57:29 +02:00
|
|
|
|
|
|
|
// Full background
|
|
|
|
g.insert('rect', ':first-child')
|
|
|
|
.attr('x', graphBox.x)
|
2019-10-11 15:39:50 +02:00
|
|
|
.attr(
|
|
|
|
'y',
|
|
|
|
getConfig().state.titleShift - getConfig().state.textHeight - getConfig().state.padding
|
|
|
|
)
|
|
|
|
.attr('width', graphBox.width + getConfig().state.padding)
|
|
|
|
.attr('height', graphBox.height + 3 + 2 * getConfig().state.textHeight)
|
|
|
|
.attr('rx', getConfig().state.radius);
|
2019-10-05 09:02:20 +02:00
|
|
|
|
|
|
|
return g;
|
|
|
|
};
|
|
|
|
|
|
|
|
const drawEndState = g => {
|
|
|
|
g.append('circle')
|
|
|
|
.style('stroke', 'black')
|
|
|
|
.style('fill', 'white')
|
2019-10-11 15:39:50 +02:00
|
|
|
.attr('r', getConfig().state.sizeUnit + getConfig().state.miniPadding)
|
|
|
|
.attr(
|
|
|
|
'cx',
|
|
|
|
getConfig().state.padding + getConfig().state.sizeUnit + getConfig().state.miniPadding
|
|
|
|
)
|
|
|
|
.attr(
|
|
|
|
'cy',
|
|
|
|
getConfig().state.padding + getConfig().state.sizeUnit + getConfig().state.miniPadding
|
|
|
|
);
|
2019-10-05 09:02:20 +02:00
|
|
|
|
|
|
|
return g
|
|
|
|
.append('circle')
|
|
|
|
.style('stroke', 'black')
|
|
|
|
.style('fill', 'black')
|
2019-10-11 15:39:50 +02:00
|
|
|
.attr('r', getConfig().state.sizeUnit)
|
|
|
|
.attr('cx', getConfig().state.padding + getConfig().state.sizeUnit + 2)
|
|
|
|
.attr('cy', getConfig().state.padding + getConfig().state.sizeUnit + 2);
|
2019-10-05 09:02:20 +02:00
|
|
|
};
|
2019-10-10 17:57:29 +02:00
|
|
|
const drawForkJoinState = (g, stateDef) => {
|
2019-10-11 15:39:50 +02:00
|
|
|
let width = getConfig().state.forkWidth;
|
|
|
|
let height = getConfig().state.forkHeight;
|
2019-10-10 17:57:29 +02:00
|
|
|
|
2019-10-10 20:55:27 +02:00
|
|
|
if (stateDef.parentId) {
|
2019-10-10 17:57:29 +02:00
|
|
|
let tmp = width;
|
|
|
|
width = height;
|
|
|
|
height = tmp;
|
|
|
|
}
|
2019-10-06 14:11:17 +02:00
|
|
|
return g
|
|
|
|
.append('rect')
|
|
|
|
.style('stroke', 'black')
|
|
|
|
.style('fill', 'black')
|
2019-10-10 17:57:29 +02:00
|
|
|
.attr('width', width)
|
|
|
|
.attr('height', height)
|
2019-10-11 15:39:50 +02:00
|
|
|
.attr('x', getConfig().state.padding)
|
|
|
|
.attr('y', getConfig().state.padding);
|
2019-10-06 14:11:17 +02:00
|
|
|
};
|
2019-10-05 09:02:20 +02:00
|
|
|
|
2019-10-06 10:52:37 +02:00
|
|
|
export const drawText = function(elem, textData, width) {
|
|
|
|
// Remove and ignore br:s
|
|
|
|
const nText = textData.text.replace(/<br\/?>/gi, ' ');
|
|
|
|
|
|
|
|
const textElem = elem.append('text');
|
|
|
|
textElem.attr('x', textData.x);
|
|
|
|
textElem.attr('y', textData.y);
|
|
|
|
textElem.style('text-anchor', textData.anchor);
|
|
|
|
textElem.attr('fill', textData.fill);
|
|
|
|
if (typeof textData.class !== 'undefined') {
|
|
|
|
textElem.attr('class', textData.class);
|
|
|
|
}
|
|
|
|
|
|
|
|
const span = textElem.append('tspan');
|
|
|
|
span.attr('x', textData.x + textData.textMargin * 2);
|
|
|
|
span.attr('fill', textData.fill);
|
|
|
|
span.text(nText);
|
|
|
|
|
|
|
|
return textElem;
|
|
|
|
};
|
|
|
|
|
|
|
|
const _drawLongText = (_text, x, y, g) => {
|
|
|
|
let textHeight = 0;
|
|
|
|
let textWidth = 0;
|
|
|
|
const textElem = g.append('text');
|
|
|
|
textElem.style('text-anchor', 'start');
|
|
|
|
textElem.attr('class', 'noteText');
|
|
|
|
|
|
|
|
let text = _text.replace(/\r\n/g, '<br/>');
|
|
|
|
text = text.replace(/\n/g, '<br/>');
|
|
|
|
const lines = text.split(/<br\/?>/gi);
|
|
|
|
for (const line of lines) {
|
|
|
|
const txt = line.trim();
|
|
|
|
|
|
|
|
if (txt.length > 0) {
|
|
|
|
const span = textElem.append('tspan');
|
2019-10-06 11:35:46 +02:00
|
|
|
span.text(txt);
|
2019-10-06 10:52:37 +02:00
|
|
|
const textBounds = span.node().getBBox();
|
|
|
|
textHeight += textBounds.height;
|
2019-10-11 15:39:50 +02:00
|
|
|
span.attr('x', x + getConfig().state.noteMargin);
|
|
|
|
span.attr('y', y + textHeight + 1.25 * getConfig().state.noteMargin);
|
2019-10-06 11:35:46 +02:00
|
|
|
// textWidth = Math.max(textBounds.width, textWidth);
|
2019-10-06 10:52:37 +02:00
|
|
|
}
|
|
|
|
}
|
2019-10-06 11:35:46 +02:00
|
|
|
return { textWidth: textElem.node().getBBox().width, textHeight };
|
2019-10-06 10:52:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Draws an actor in the diagram with the attaced line
|
|
|
|
* @param center - The center of the the actor
|
|
|
|
* @param pos The position if the actor in the liost of actors
|
|
|
|
* @param description The text in the box
|
|
|
|
*/
|
|
|
|
|
|
|
|
export const drawNote = (text, g) => {
|
2019-10-11 18:12:24 +02:00
|
|
|
g.attr('class', 'state-note');
|
2019-10-06 10:52:37 +02:00
|
|
|
const note = g
|
|
|
|
.append('rect')
|
|
|
|
.attr('x', 0)
|
2019-10-11 15:39:50 +02:00
|
|
|
.attr('y', getConfig().state.padding);
|
2019-10-06 10:52:37 +02:00
|
|
|
const rectElem = g.append('g');
|
|
|
|
|
|
|
|
const { textWidth, textHeight } = _drawLongText(text, 0, 0, rectElem);
|
2019-10-11 15:39:50 +02:00
|
|
|
note.attr('height', textHeight + 2 * getConfig().state.noteMargin);
|
|
|
|
note.attr('width', textWidth + getConfig().state.noteMargin * 2);
|
2019-10-06 10:52:37 +02:00
|
|
|
|
|
|
|
return note;
|
|
|
|
};
|
|
|
|
|
2019-10-05 09:02:20 +02:00
|
|
|
/**
|
|
|
|
* Starting point for drawing a state. The function finds out the specifics
|
|
|
|
* about the state and renders with approprtiate function.
|
|
|
|
* @param {*} elem
|
|
|
|
* @param {*} stateDef
|
|
|
|
*/
|
2019-10-10 20:55:27 +02:00
|
|
|
|
|
|
|
let cnt = 0;
|
2019-10-05 09:02:20 +02:00
|
|
|
export const drawState = function(elem, stateDef, graph, doc) {
|
|
|
|
const id = stateDef.id;
|
|
|
|
const stateInfo = {
|
|
|
|
id: id,
|
|
|
|
label: stateDef.id,
|
|
|
|
width: 0,
|
|
|
|
height: 0
|
|
|
|
};
|
|
|
|
|
|
|
|
const g = elem
|
|
|
|
.append('g')
|
|
|
|
.attr('id', id)
|
2019-10-11 18:12:24 +02:00
|
|
|
.attr('class', 'stateGroup');
|
2019-10-05 09:02:20 +02:00
|
|
|
|
|
|
|
if (stateDef.type === 'start') drawStartState(g);
|
|
|
|
if (stateDef.type === 'end') drawEndState(g);
|
2019-10-10 17:57:29 +02:00
|
|
|
if (stateDef.type === 'fork' || stateDef.type === 'join') drawForkJoinState(g, stateDef);
|
2019-10-06 10:52:37 +02:00
|
|
|
if (stateDef.type === 'note') drawNote(stateDef.note.text, g);
|
2019-10-06 15:44:31 +02:00
|
|
|
if (stateDef.type === 'divider') drawDivider(g);
|
2019-10-05 09:02:20 +02:00
|
|
|
if (stateDef.type === 'default' && stateDef.descriptions.length === 0)
|
|
|
|
drawSimpleState(g, stateDef);
|
|
|
|
if (stateDef.type === 'default' && stateDef.descriptions.length > 0) drawDescrState(g, stateDef);
|
|
|
|
|
|
|
|
const stateBox = g.node().getBBox();
|
2019-10-11 15:39:50 +02:00
|
|
|
stateInfo.width = stateBox.width + 2 * getConfig().state.padding;
|
|
|
|
stateInfo.height = stateBox.height + 2 * getConfig().state.padding;
|
2019-10-05 09:02:20 +02:00
|
|
|
|
|
|
|
idCache.set(id, stateInfo);
|
|
|
|
// stateCnt++;
|
|
|
|
return stateInfo;
|
|
|
|
};
|
|
|
|
|
|
|
|
let edgeCount = 0;
|
|
|
|
export const drawEdge = function(elem, path, relation) {
|
|
|
|
const getRelationType = function(type) {
|
|
|
|
switch (type) {
|
|
|
|
case stateDb.relationType.AGGREGATION:
|
|
|
|
return 'aggregation';
|
|
|
|
case stateDb.relationType.EXTENSION:
|
|
|
|
return 'extension';
|
|
|
|
case stateDb.relationType.COMPOSITION:
|
|
|
|
return 'composition';
|
|
|
|
case stateDb.relationType.DEPENDENCY:
|
|
|
|
return 'dependency';
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
path.points = path.points.filter(p => !Number.isNaN(p.y));
|
|
|
|
|
|
|
|
// The data for our line
|
|
|
|
const lineData = path.points;
|
|
|
|
|
|
|
|
// This is the accessor function we talked about above
|
|
|
|
const lineFunction = d3
|
|
|
|
.line()
|
|
|
|
.x(function(d) {
|
|
|
|
return d.x;
|
|
|
|
})
|
|
|
|
.y(function(d) {
|
|
|
|
return d.y;
|
|
|
|
})
|
|
|
|
.curve(d3.curveBasis);
|
|
|
|
|
|
|
|
const svgPath = elem
|
|
|
|
.append('path')
|
|
|
|
.attr('d', lineFunction(lineData))
|
|
|
|
.attr('id', 'edge' + edgeCount)
|
2019-10-11 18:12:24 +02:00
|
|
|
.attr('class', 'transition');
|
2019-10-05 09:02:20 +02:00
|
|
|
let url = '';
|
2019-10-11 15:39:50 +02:00
|
|
|
if (getConfig().state.arrowMarkerAbsolute) {
|
2019-10-05 09:02:20 +02:00
|
|
|
url =
|
|
|
|
window.location.protocol +
|
|
|
|
'//' +
|
|
|
|
window.location.host +
|
|
|
|
window.location.pathname +
|
|
|
|
window.location.search;
|
|
|
|
url = url.replace(/\(/g, '\\(');
|
|
|
|
url = url.replace(/\)/g, '\\)');
|
|
|
|
}
|
|
|
|
|
|
|
|
svgPath.attr(
|
|
|
|
'marker-end',
|
|
|
|
'url(' + url + '#' + getRelationType(stateDb.relationType.DEPENDENCY) + 'End' + ')'
|
|
|
|
);
|
|
|
|
|
|
|
|
if (typeof relation.title !== 'undefined') {
|
2019-10-11 18:12:24 +02:00
|
|
|
const g = elem.append('g').attr('class', 'stateLabel');
|
2019-10-05 09:02:20 +02:00
|
|
|
const label = g
|
|
|
|
.append('text')
|
|
|
|
.attr('text-anchor', 'middle')
|
|
|
|
.text(relation.title);
|
|
|
|
const { x, y } = utils.calcLabelPosition(path.points);
|
|
|
|
label.attr('x', x).attr('y', y);
|
|
|
|
const bounds = label.node().getBBox();
|
|
|
|
g.insert('rect', ':first-child')
|
|
|
|
.attr('class', 'box')
|
2019-10-11 15:39:50 +02:00
|
|
|
.attr('x', bounds.x - getConfig().state.padding / 2)
|
|
|
|
.attr('y', bounds.y - getConfig().state.padding / 2)
|
|
|
|
.attr('width', bounds.width + getConfig().state.padding)
|
|
|
|
.attr('height', bounds.height + getConfig().state.padding);
|
2019-10-05 09:02:20 +02:00
|
|
|
// Debug points
|
|
|
|
// path.points.forEach(point => {
|
|
|
|
// g.append('circle')
|
|
|
|
// .style('stroke', 'red')
|
|
|
|
// .style('fill', 'red')
|
|
|
|
// .attr('r', 1)
|
|
|
|
// .attr('cx', point.x)
|
|
|
|
// .attr('cy', point.y);
|
|
|
|
// });
|
|
|
|
// g.append('circle')
|
|
|
|
// .style('stroke', 'blue')
|
|
|
|
// .style('fill', 'blue')
|
|
|
|
// .attr('r', 1)
|
|
|
|
// .attr('cx', x)
|
|
|
|
// .attr('cy', y);
|
|
|
|
}
|
|
|
|
|
|
|
|
edgeCount++;
|
|
|
|
};
|