Skip to content

Commit

Permalink
Set SVG viewBox
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerlong committed Apr 12, 2018
1 parent 44ff608 commit a499296
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "mermaid",
"version": "8.0.0-rc.7",
"version": "8.0.0-rc.8",
"description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.",
"main": "dist/mermaid.core.js",
"keywords": [
Expand Down
7 changes: 5 additions & 2 deletions src/diagrams/flowchart/flowRenderer.js
Expand Up @@ -406,8 +406,11 @@ export const draw = function (text, id) {
})

const padding = 8
svg.attr('width', g.maxX - g.minX + padding * 2)
svg.attr('height', g.maxY - g.minY + padding * 2)
const width = g.maxX - g.minX + padding * 2
const height = g.maxY - g.minY + padding * 2
svg.attr('width', '100%')
svg.attr('style', `max-width: ${width}px;`)
svg.attr('viewBox', `0 0 ${width} ${height}`)
svg.select('g').attr('transform', `translate(${padding - g.minX}, ${padding - g.minY})`)

// Index nodes
Expand Down

0 comments on commit a499296

Please sign in to comment.