Skip to content

Commit 1139af8

Browse files
better visual routing
1 parent e6cab85 commit 1139af8

File tree

6 files changed

+25018
-92
lines changed

6 files changed

+25018
-92
lines changed

gulpfile.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var gulp = require("gulp"),
1818

1919
var banner = [
2020
"",
21-
"/** <%= pkg.name %>",
21+
"/*! <%= pkg.name %>",
2222
" ** <%= pkg.description %>",
2323
" ** @author <%= pkg.author %>",
2424
" ** @version <%= pkg.version %>",
@@ -35,17 +35,18 @@ gulp.task("clean", function () {
3535

3636
gulp.task("gatherLibs", ["clean"], function () {
3737
return gulp.src([
38-
"web/jsLib/joint.shapes.uml.js"
38+
"web/jsLib/joint.js",
39+
"web/jsLib/joint.shapes.uml.js"
3940
])
4041
.pipe(uglify({
4142
output: {
4243
ascii_only: true,
4344
width: 30000,
4445
max_line_len: 30000
45-
}
46+
},
47+
preserveComments: "some"
4648
}))
47-
.pipe(addsrc.prepend([
48-
"web/jsLib/joint.min.js",
49+
.pipe(addsrc.append([
4950
"web/jsLib/joint.layout.DirectedGraph.min.js"
5051
]))
5152
.pipe(stripComments({ safe: true }))
@@ -63,7 +64,8 @@ gulp.task("gatherScripts", ["clean", "gatherLibs"], function () {
6364
ascii_only: true,
6465
width: 30000,
6566
max_line_len: 30000
66-
}
67+
},
68+
preserveComments: "some"
6769
}))
6870
.pipe(header(banner, { pkg: pkg }))
6971
.pipe(addsrc.prepend("build/web/js/CacheUMLExplorer.js"))

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"gulp-rename": "^1.2.0",
2121
"gulp-replace": "^0.5.0",
2222
"gulp-strip-comments": "^1.0.1",
23-
"gulp-uglify": "^1.0.1",
23+
"gulp-uglify": "^1.2.0",
2424
"gulp-wrap": "^0.5.0",
2525
"gulp-zip": "^2.0.2"
2626
},

web/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<link rel="stylesheet" href="css/joint.min.css"/>
1212
<!-- endbuild -->
1313
<!-- build:js -->
14-
<script type="text/javascript" src="jsLib/joint.min.js"></script>
14+
<script type="text/javascript" src="jsLib/joint.js"></script>
1515
<script type="text/javascript" src="jsLib/joint.shapes.uml.js"></script>
1616
<script type="text/javascript" src="jsLib/joint.layout.DirectedGraph.min.js"></script>
1717
<script type="text/javascript" src="js/ClassView.js"></script>
@@ -21,7 +21,7 @@
2121
<script type="text/javascript" src="js/Source.js"></script>
2222
<!-- endbuild -->
2323
</head>
24-
<body onload="var cue = new CacheUMLExplorer(document.getElementById('treeView'), document.getElementById('classView'))">
24+
<body onload="cue = new CacheUMLExplorer(document.getElementById('treeView'), document.getElementById('classView'))">
2525
<div class="ui-body">
2626
<div class="ui-sideBlock">
2727
<div id="treeView">

web/js/ClassView.js

Lines changed: 5 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,17 @@ ClassView.prototype.render = function (data) {
148148
}
149149

150150
joint.layout.DirectedGraph.layout(this.graph, {
151-
setLinkVertices: false,
151+
setLinkVertices: true,
152152
nodeSep: 100,
153153
rankSep: 100
154154
});
155155

156156
this.updateSizes();
157157

158+
for (var i in this.links) {
159+
this.paper.findViewByModel(this.links[i]).update();
160+
}
161+
158162
var bb = this.paper.getContentBBox(), q = this.paper;
159163
this.paper.setOrigin(
160164
q.options.width/2 - bb.width/2,
@@ -302,71 +306,4 @@ ClassView.prototype.init = function () {
302306
self.zoom(null);
303307
});
304308

305-
//var classes = {
306-
//
307-
// mammal: new uml.Interface({
308-
// position: { x:300 , y: 50 },
309-
// size: { width: 240, height: 100 },
310-
// name: 'Mammal',
311-
// attributes: ['dob: Date'],
312-
// methods: ['+ setDateOfBirth(dob: Date): Void','+ getAgeAsDays(): Numeric']
313-
// }),
314-
//
315-
// person: new uml.Abstract({
316-
// position: { x:300 , y: 300 },
317-
// size: { width: 240, height: 100 },
318-
// name: 'Person',
319-
// attributes: ['firstName: String','lastName: String'],
320-
// methods: ['+ setName(first: String, last: String): Void','+ getName(): String']
321-
// }),
322-
//
323-
// bloodgroup: new uml.Class({
324-
// position: { x:20 , y: 190 },
325-
// size: { width: 220, height: 100 },
326-
// name: 'BloodGroup',
327-
// attributes: ['bloodGroup: String'],
328-
// methods: ['+ isCompatible(bG: String): Boolean']
329-
// }),
330-
//
331-
// address: new uml.Class({
332-
// position: { x:630 , y: 190 },
333-
// size: { width: 160, height: 100 },
334-
// name: 'Address',
335-
// attributes: ['houseNumber: Integer','streetName: String','town: String','postcode: String'],
336-
// methods: []
337-
// }),
338-
//
339-
// man: new uml.Class({
340-
// position: { x:200 , y: 500 },
341-
// size: { width: 180, height: 50 },
342-
// name: 'Man'
343-
// }),
344-
//
345-
// woman: new uml.Class({
346-
// position: { x:450 , y: 500 },
347-
// size: { width: 180, height: 50 },
348-
// name: 'Woman',
349-
// methods: ['+ giveABrith(): Person []']
350-
// })
351-
//
352-
//
353-
//};
354-
//
355-
//_.each(classes, function(c) { graph.addCell(c); });
356-
//
357-
//var relations = [
358-
// new uml.Generalization({
359-
// source: { id: classes.man.id },
360-
// target: { id: classes.person.id },
361-
// router: { name: 'manhattan' },
362-
// connector: { name: 'rounded' }
363-
// }),
364-
// new uml.Generalization({ source: { id: classes.woman.id }, target: { id: classes.person.id }}),
365-
// new uml.Implementation({ source: { id: classes.person.id }, target: { id: classes.mammal.id }}),
366-
// new uml.Aggregation({ source: { id: classes.person.id }, target: { id: classes.address.id }}),
367-
// new uml.Composition({ source: { id: classes.person.id }, target: { id: classes.bloodgroup.id }})
368-
//];
369-
//
370-
//_.each(relations, function(r) { graph.addCell(r); });
371-
372309
};

0 commit comments

Comments
 (0)