Skip to content

Commit 870aca6

Browse files
dominant-baseline:central for vertical centering
the latest of many attempts to get this right previously we had dominant-baseline:text-after-edge and dy 0.5em but that didn't seem tall enough ref f0f6409 / c574c96 for last attempt i don't understand why i upvoted https://stackoverflow.com/questions/12250403/vertical-alignment-of-text-element-in-svg but still tried to offset the bottom of the text instead of using `central` we'll see..... fixes #96 ?
1 parent 50dfbaf commit 870aca6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

dc.graph.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
.dc-graph text.node-label {
1414
font: bold 14px verdana, sans-serif;
1515
text-anchor: middle;
16-
dominant-baseline: text-after-edge;
16+
dominant-baseline: central;
1717
pointer-events: none;
1818
}
1919

src/node_contents.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dc_graph.text_contents = function() {
1313
else if(typeof lines === 'string')
1414
lines = [lines];
1515
var lineHeight = _contents.parent().nodeLineHeight();
16-
var first = 1 - ((lines.length - 1) * lineHeight + 1)/2;
16+
var first = 0.5 - ((lines.length - 1) * lineHeight + 1)/2;
1717
return lines.map(function(line, i) { return {node: n, line: line, yofs: (i==0 ? first : lineHeight) + 'em'}; });
1818
});
1919
tspan.enter().append('tspan');

0 commit comments

Comments
 (0)