Skip to content

Commit 21b263e

Browse files
visualizing classMethods
1 parent 1139af8 commit 21b263e

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

web/css/classView.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#classView {
22
height: 100%;
3+
cursor: -webkit-grab; cursor: -moz-grab;
34
}
45

56
.uml-class-name-rect {

web/js/ClassView.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ ClassView.prototype.createClassInstance = function (name, classMetaData) {
7272
classProps = classMetaData["properties"],
7373
classMethods = classMetaData["methods"];
7474

75-
var insertString = function (array, string) {
75+
var insertString = function (array, string, extraString) {
7676
string.match(/.{1,44}/g).forEach(function (p) {
77-
array.push(p);
77+
array.push(p + (extraString ? extraString : ""));
7878
});
7979
};
8080

@@ -94,10 +94,17 @@ ClassView.prototype.createClassInstance = function (name, classMetaData) {
9494
}
9595
return arr;
9696
})(classParams, classProps),
97-
methods: methArr = (function (ps) {
97+
methods: methArr = (function (met) {
9898
var arr = [], n;
99-
for (n in ps) {
100-
insertString(arr, "+ " + n + (ps[n]["returns"] ? ": " + ps[n]["returns"] : ""));
99+
for (n in met) {
100+
insertString(
101+
arr,
102+
"+ " + n + (met[n]["returns"] ? ": " + met[n]["returns"] : ""),
103+
(met[n]["classMethod"] ?
104+
"\x1b" + JSON.stringify({STYLES:{
105+
textDecoration: "underline"
106+
}}) : "")
107+
);
101108
}
102109
return arr;
103110
})(classMethods),

web/jsLib/joint.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17205,12 +17205,25 @@ if ( typeof window === "object" && typeof window.document === "object" ) {
1720517205

1720617206
for (; i < lines.length; i++) {
1720717207

17208+
var jj, setup;
17209+
1720817210
// Shift all the <tspan> but first by one line (`1em`)
1720917211
tspan = V('tspan', { dy: (i == 0 ? '0em' : opt.lineHeight || '1em'), x: this.attr('x') || 0 });
1721017212
tspan.addClass('line');
1721117213
if (!lines[i]) {
1721217214
tspan.addClass('empty-line');
1721317215
}
17216+
//tspan.node.style.textDecoration = "underline";
17217+
if (lines[i].indexOf("\x1b") !== -1) {
17218+
jj = lines[i].split("\x1b");
17219+
lines[i] = jj[0];
17220+
setup = JSON.parse(jj[1]);
17221+
if (setup["STYLES"]) {
17222+
for (var j in setup["STYLES"]) {
17223+
tspan.node.style[j] = setup["STYLES"][j];
17224+
}
17225+
}
17226+
}
1721417227
// Make sure the textContent is never empty. If it is, add an additional
1721517228
// space (an invisible character) so that following lines are correctly
1721617229
// relatively positioned. `dy=1em` won't work with empty lines otherwise.

0 commit comments

Comments
 (0)