Skip to content

Commit

Permalink
Merge pull request #20 from sponbergbadger/allowUserChangeDefaultSett…
Browse files Browse the repository at this point in the history
…ings

allow user to change default settings
  • Loading branch information
sponbergbadger committed Feb 9, 2020
2 parents 5b5496f + 635d8f2 commit 9001b76
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
29 changes: 10 additions & 19 deletions lib/DiagramParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@ const InputFile = require('./InputFile')
const ShapeParser = require('./ShapeParser')
const Util = require('./Util')

const defaultSettings = {
'horizontal-spacer': 20,
'vertical-spacer': 20,
'text-width': 5,
'text-height': 30,
'grid-align': 'center',
'grid-valign': 'middle',
}

module.exports = class DiagramParser {

constructor(diagramFactory) {
Expand All @@ -28,18 +19,18 @@ module.exports = class DiagramParser {
this.lastGridAlignment = null
this.globalStyles = {}
this.margin = {
left: 30,
right: 30,
top: 30,
bottom: 30
left: this.diagramFactory.margin.left,
right: this.diagramFactory.margin.right,
top: this.diagramFactory.margin.top,
bottom: this.diagramFactory.margin.bottom
}
this.settings = {
'horizontal-spacer': defaultSettings['horizontal-spacer'],
'vertical-spacer': defaultSettings['vertical-spacer'],
'text-width': defaultSettings['text-width'],
'text-height': defaultSettings['text-height'],
'grid-align': defaultSettings['grid-align'],
'grid-valign': defaultSettings['grid-valign'],
'horizontal-spacer': this.diagramFactory.defaultSettings['horizontal-spacer'],
'vertical-spacer': this.diagramFactory.defaultSettings['vertical-spacer'],
'text-width': this.diagramFactory.defaultSettings['text-width'],
'text-height': this.diagramFactory.defaultSettings['text-height'],
'grid-align': this.diagramFactory.defaultSettings['grid-align'],
'grid-valign': this.diagramFactory.defaultSettings['grid-valign'],
}
this.debug = {
showGrid: false
Expand Down
14 changes: 14 additions & 0 deletions lib/SvgDiagramFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ module.exports = class SvgDiagramFactory {
this.basePath = basePath
this.parsersProducersRenderers = new ParsersProducersRenderers([...builtinPaths, ...pluginPathArray])
this.convertRelativePathsToAbsolute = false
this.margin = {
left: 30,
right: 30,
top: 30,
bottom: 30
}
this.defaultSettings = {
'horizontal-spacer': 20,
'vertical-spacer': 20,
'text-width': 5,
'text-height': 30,
'grid-align': 'center',
'grid-valign': 'middle',
}
}

getParsers() {
Expand Down

0 comments on commit 9001b76

Please sign in to comment.