From 2bc3a0f97c1fcc49929c4814c22f28756846836e Mon Sep 17 00:00:00 2001 From: megantriplett Date: Fri, 21 Mar 2025 15:28:34 -0400 Subject: [PATCH] vert is now a copy of milestone tag --- .../src/diagrams/gantt/ganttRenderer.js | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/packages/mermaid/src/diagrams/gantt/ganttRenderer.js b/packages/mermaid/src/diagrams/gantt/ganttRenderer.js index a10eb100f..7ef58f9c2 100644 --- a/packages/mermaid/src/diagrams/gantt/ganttRenderer.js +++ b/packages/mermaid/src/diagrams/gantt/ganttRenderer.js @@ -284,6 +284,14 @@ export const draw = function (text, id, version, diagObj) { 0.5 * theBarHeight ); } + if (d.vert) { + return ( + timeScale(d.startTime) + + theSidePad + + 0.5 * (timeScale(d.endTime) - timeScale(d.startTime)) - + 0.5 * theBarHeight + ); + } return timeScale(d.startTime) + theSidePad; }) .attr('y', function (d, i) { @@ -295,6 +303,9 @@ export const draw = function (text, id, version, diagObj) { if (d.milestone) { return theBarHeight; } + if (d.vert) { + return theBarHeight; + } return timeScale(d.renderEndTime || d.endTime) - timeScale(d.startTime); }) .attr('height', theBarHeight) @@ -354,6 +365,9 @@ export const draw = function (text, id, version, diagObj) { if (d.milestone) { taskClass = ' milestone ' + taskClass; } + if (d.vert) { + taskClass = ' vert ' + taskClass; + } taskClass += secNum; @@ -381,6 +395,13 @@ export const draw = function (text, id, version, diagObj) { if (d.milestone) { endX = startX + theBarHeight; } + + if (d.vert) { + startX += 0.5 * (timeScale(d.endTime) - timeScale(d.startTime)) - 0.5 * theBarHeight; + } + if (d.vert) { + endX = startX + theBarHeight; + } const textWidth = this.getBBox().width; // Check id text width > width of rectangle @@ -406,6 +427,9 @@ export const draw = function (text, id, version, diagObj) { if (d.milestone) { endX = startX + theBarHeight; } + if (d.vert) { + endX = startX + theBarHeight; + } const textWidth = this.getBBox().width; let classStr = ''; @@ -445,6 +469,10 @@ export const draw = function (text, id, version, diagObj) { taskType += ' milestoneText'; } + if (d.vert) { + taskType += ' vertText'; + } + // Check id text width > width of rectangle if (textWidth > endX - startX) { if (endX + textWidth + 1.5 * conf.leftPadding > w) {