Skip to content

Commit

Permalink
Finally fix DMRS top link label
Browse files Browse the repository at this point in the history
  • Loading branch information
goodmami committed Aug 14, 2020
1 parent d58bd6d commit 1ce64a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions viz/delphin-viz.css
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@

.link.top text.rargname {
text-anchor: start;
dominant-baseline: hanging;
}

.node.in { fill: red; }
Expand Down
9 changes: 4 additions & 5 deletions viz/dmrs.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@

function DMRS(parentElement, dmrs) {
var dmrsData = JSON.parse(JSON.stringify(dmrs)); // make a copy
var maxWidth = 600,
height = 300;

var level_dy = 25, // vertical separation between edges
edge_radius = 15, // rounded corner radius,
Expand Down Expand Up @@ -80,8 +78,7 @@ function DMRS(parentElement, dmrs) {
y1 = dmrs.nodes[link.target].bbox.height;
if (link.from == 0) {
y2 = y1 + (((link.dir == 1 ? dmrs.maxTopLevel : dmrs.maxBottomLevel) + 1) * level_dy);
link.midpoint = {"x": x2,
"y": (y1 + y2) / 2};
link.midpoint = {"x": x2 + 4, "y": y2};
return ["M", x2, y2, "L", x2, y1].join(' ');
}
// the following is only for non-TOP links
Expand Down Expand Up @@ -324,7 +321,9 @@ function DMRS(parentElement, dmrs) {
.attr("class", "rargname")
.attr("x", function(d) { return d.midpoint.x; })
.attr("y", function(d) { return d.midpoint.y * (-1 * d.dir) - 3; })
.text(function(d) { return d.rargname + "/" + d.post; } );
.text(function(d) {
if (d.from == 0) { return "TOP"; } else { return d.rargname + "/" + d.post; }
});
// });
return svg[0][0];
}
Expand Down

0 comments on commit 1ce64a7

Please sign in to comment.