From 33da5bcee19c29913bb510ab30105fdf2d50c445 Mon Sep 17 00:00:00 2001 From: Tyler Long Date: Tue, 20 Mar 2018 20:08:52 +0800 Subject: [PATCH] Fix flowchart cut off issue --- dist/index.html | 12 +++++++++++- package.json | 2 +- src/diagrams/flowchart/flowRenderer.js | 7 ++++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/dist/index.html b/dist/index.html index 3b468c9b1..2224985df 100644 --- a/dist/index.html +++ b/dist/index.html @@ -7,6 +7,16 @@ +
+ graph TD + A-->B + A-->C + A-->Z + A-->Y + B-->Y + Z-->Y + Y-->A +
graph TD 9e122290_1ec3_e711_8c5a_005056ad0002("fa:fa-creative-commons My System | Test Environment") @@ -208,7 +218,7 @@ Class08 <--> C2: Cool label theme: 'forest', // themeCSS: '.node rect { fill: red; }', logLevel: 3, - flowchart: { curve: 'basis' }, + flowchart: { curve: 'linear' }, gantt: { axisFormat: '%m/%d/%Y' }, sequence: { actorMargin: 50 }, // sequenceDiagram: { actorMargin: 300 } // deprecated diff --git a/package.json b/package.json index 0032b1ea5..743658c06 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mermaid", - "version": "8.0.0-rc.1", + "version": "8.0.0-rc.2", "description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.", "main": "dist/mermaid.core.js", "keywords": [ diff --git a/src/diagrams/flowchart/flowRenderer.js b/src/diagrams/flowchart/flowRenderer.js index a335dc248..e9ee7d2af 100644 --- a/src/diagrams/flowchart/flowRenderer.js +++ b/src/diagrams/flowchart/flowRenderer.js @@ -409,8 +409,8 @@ export const draw = function (text, id) { // Center the graph svg.attr('height', '100%') svg.attr('width', conf.width) - svg.attr('viewBox', '0 0 ' + (g.graph().width + 20) + ' ' + (g.graph().height + 20)) - svg.attr('style', 'max-width:' + (g.graph().width + 20) + 'px;') + svg.attr('viewBox', '0 0 ' + (g.graph().width + 40) + ' ' + (g.graph().height + 40)) + svg.attr('style', 'max-width:' + (g.graph().width + 40) + 'px;') } else { // Center the graph svg.attr('height', g.graph().height) @@ -419,8 +419,9 @@ export const draw = function (text, id) { } else { svg.attr('width', conf.width) } - svg.attr('viewBox', '0 0 ' + (g.graph().width + 20) + ' ' + (g.graph().height + 20)) + svg.attr('viewBox', '0 0 ' + (g.graph().width + 40) + ' ' + (g.graph().height + 40)) } + svg.select('g').attr('transform', 'translate(20, 20)') // Index nodes flowDb.indexNodes('subGraph' + i)