summaryrefslogtreecommitdiff
path: root/src/client/view
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2015-04-14 11:10:08 +0200
committerAlon Levy <alon@pobox.com>2015-04-14 13:32:38 +0200
commitb99876f22dc728e8899255dbad31c50e07005043 (patch)
tree6f27b84419e906ea30e95c9e2ebd719ed819c8f1 /src/client/view
parent800e89c230dceb2e1392979abde6a43c9a734942 (diff)
client: place image+text on the middle of the bounding box
Diffstat (limited to 'src/client/view')
-rw-r--r--src/client/view/graph_view.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/client/view/graph_view.js b/src/client/view/graph_view.js
index 8baa1adc..63b1a075 100644
--- a/src/client/view/graph_view.js
+++ b/src/client/view/graph_view.js
@@ -1118,7 +1118,11 @@ function GraphView(spec) {
return "translate(" + x + "," + y + ")";
}
- function transform(d) { return translate(d.bx, d.by); }
+ function transform(d, istext) {
+ var bbox = $('#' + d.id)[0].getBBox();
+
+ return translate(d.bx - bbox.width / 2, d.by - bbox.height / 2);
+ }
// transform nodes first to record bubble x & y (bx & by)
node.attr("transform", transform);
node_text.attr("transform", transform);