Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #100 - ability to define scale factor #142

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "bower_components"
}
8 changes: 0 additions & 8 deletions build/sequence-diagram-min.js

This file was deleted.

1 change: 0 additions & 1 deletion build/sequence-diagram-min.js.map

This file was deleted.

10 changes: 6 additions & 4 deletions src/sequence-diagram.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
return this._paper.rect(x, y, w, h);
},

draw : function(container) {
draw : function(container, options) {
var diagram = this.diagram;
this.init_paper(container);
this.init_font();
Expand All @@ -224,7 +224,8 @@
var title_height = this._title ? this._title.height : 0;

this._paper.setStart();
this._paper.setSize(diagram.width, diagram.height);
this._paper.setSize(diagram.width * options.scale, diagram.height * options.scale);
this._paper.setViewBox(0, 0, diagram.width, diagram.height);

var y = DIAGRAM_MARGIN + title_height;

Expand Down Expand Up @@ -625,7 +626,8 @@

Diagram.prototype.drawSVG = function (container, options) {
var default_options = {
theme: 'hand'
theme: 'hand',
scale: 1
};

options = _.defaults(options || {}, default_options);
Expand All @@ -634,7 +636,7 @@
throw new Error("Unsupported theme: " + options.theme);

var drawing = new themes[options.theme](this);
drawing.draw(container);
drawing.draw(container, options);

}; // end of drawSVG

6 changes: 3 additions & 3 deletions test/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
</head>

<textarea id="language" rows="10" cols="50">
#Note left of A: Note to the\n left of A
#Note right of A: Note to the\n right of A
#Note over A: Note over A
Note over A,B: Note over A,B
</textarea>
<button id="parse" type="button">Click Me!</button>
<button id="parse" type="button">Click Me!</button>

<div id="diagram"></div>

Expand Down Expand Up @@ -44,7 +44,7 @@
var diagram = Diagram.parse($('#language').val());
console.log(diagram);

diagram.drawSVG('diagram', {theme: 'hand'});
diagram.drawSVG('diagram', {theme: 'simple', scale: 2});
//} catch (e) {
// console.log(e);
//}
Expand Down