Skip to content

Commit db6aaf2

Browse files
committed
Support to the zoom and pan of the flowchart.
1 parent 1c58176 commit db6aaf2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/flowchart.chart.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,15 @@ FlowChart.prototype.render = function() {
9898
}
9999
}
100100

101-
this.paper.setSize(maxX + this.options['line-width'], maxY + this.options['line-width']);
101+
var scale = this.options['scale'];
102+
var lineWidth = this.options['line-width'];
103+
this.paper.setSize((maxX * scale) + (lineWidth * scale), (maxY * scale) + (lineWidth * scale));
104+
this.paper.setViewBox(0, 0, maxX + lineWidth, maxY + lineWidth, true);
102105
};
103106

104107
FlowChart.prototype.clean = function() {
105108
if (this.paper) {
106109
var paperDom = this.paper.canvas;
107110
paperDom.parentNode.removeChild(paperDom);
108111
}
109-
};
112+
};

src/flowchart.defaults.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ var o = {
1717
'no-text': 'no',
1818
'arrow-end': 'block',
1919
'class': 'flowchart',
20+
'scale': 1,
2021
'symbols': {
2122
'start': {},
2223
'end': {},

0 commit comments

Comments
 (0)