diff --git a/package.json b/package.json index f2600d93c..226d68a2b 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,6 @@ }, "dependencies": { "d3": "^4.13.0", - "d3-textwrap": "^2.0.2", "dagre-d3-renderer": "^0.5.1", "dagre-layout": "^0.8.6", "graphlibrary": "^2.2.0", diff --git a/src/diagrams/sequenceDiagram/svgDraw.js b/src/diagrams/sequenceDiagram/svgDraw.js index 5e6e3ab71..17b9f8273 100644 --- a/src/diagrams/sequenceDiagram/svgDraw.js +++ b/src/diagrams/sequenceDiagram/svgDraw.js @@ -33,14 +33,6 @@ export const drawText = function (elem, textData, width) { span.attr('x', textData.x + textData.textMargin * 2) span.attr('fill', textData.fill) span.text(nText) - if (typeof textElem.textwrap !== 'undefined') { - textElem.textwrap({ - x: textData.x, // bounding box is 300 pixels from the left - y: textData.y, // bounding box is 400 pixels from the top - width: width, // bounding box is 500 pixels across - height: 1800 // bounding box is 600 pixels tall - }, textData.textMargin) - } return textElem } @@ -61,6 +53,7 @@ export const drawLabel = function (elem, txtObject) { txtObject.x = txtObject.x + 0.5 * txtObject.labelMargin drawText(elem, txtObject) } + let actorCnt = -1 /** * Draws an actor in the diagram with the attaced line @@ -265,22 +258,8 @@ const _drawTextCandidateFunc = (function () { .style('text-anchor', 'middle') text.append('tspan') .attr('x', x + width / 2).attr('dy', '0') - .text(content) + .text(content) // todo: fix position y - if (typeof (text.textwrap) !== 'undefined') { - text.textwrap({ // d3textwrap - x: x + width / 2, y: y, width: width, height: height - }, 0) - // vertical aligment after d3textwrap expans tspan to multiple tspans - let tspans = text.selectAll('tspan') - if (tspans.length > 0 && tspans[0].length > 0) { - tspans = tspans[0] - // set y of to the mid y of the first line - text.attr('y', y + (height / 2.0 - text[0][0].getBBox().height * (1 - 1.0 / tspans.length) / 2.0)) - .attr('dominant-baseline', 'central') - .attr('alignment-baseline', 'central') - } - } _setTextAttrs(text, textAttrs) } diff --git a/todo.md b/todo.md index 0dd040568..ab7de829c 100644 --- a/todo.md +++ b/todo.md @@ -7,8 +7,6 @@ - Setup code coverage - Create a desktop client - Fix sequence diagram node label position issue - - caused by d3-textwrap? - - remove textwrap feature? - Fix flowchart interpolate/curve issue - not a common feature so dist/index.html cannot reproduce this issue - Support customization of gantt diagram xAxis format diff --git a/yarn.lock b/yarn.lock index 46c3fb217..253b18325 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2411,7 +2411,7 @@ d3-scale@1.0.7: d3-time "1" d3-time-format "2" -d3-selection@1, d3-selection@1.3.0, d3-selection@^1.0.2, d3-selection@^1.1.0: +d3-selection@1, d3-selection@1.3.0, d3-selection@^1.1.0: version "1.3.0" resolved "https://registry.yarnpkg.com/d3-selection/-/d3-selection-1.3.0.tgz#d53772382d3dc4f7507bfb28bcd2d6aed2a0ad6d" @@ -2421,12 +2421,6 @@ d3-shape@1.2.0: dependencies: d3-path "1" -d3-textwrap@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/d3-textwrap/-/d3-textwrap-2.0.2.tgz#7026dad5fd109bb280bfa3b5af2a8f6981290034" - dependencies: - d3-selection "^1.0.2" - d3-time-format@2, d3-time-format@2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/d3-time-format/-/d3-time-format-2.1.1.tgz#85b7cdfbc9ffca187f14d3c456ffda268081bb31"