Skip to content

Commit 7950029

Browse files
committed
View outgoing conext menu option now working for nodes in focus.
1 parent 822138a commit 7950029

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

treemap.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ d3.json("whitematter.json", function(d) {
6868

6969
// write text into grandparent
7070
// and activate click's handler
71-
grandparent.datum(d.parent).on("click", transition).select("text").text(name(d));
71+
grandparent.datum(d.parent).on("click", d => transition(d)).select("text").text(name(d));
7272
// grandparent color
7373
grandparent.datum(d.parent).select("rect").attr("fill", function() {
7474
return 'grey'
@@ -80,7 +80,7 @@ d3.json("whitematter.json", function(d) {
8080
g.filter(function(d) {
8181
return d.children;
8282

83-
}).classed("children", true).on("click", transition);
83+
}).classed("children", true).on("click", d => transition(d));
8484
g.selectAll(".child").data(function(d) {
8585
return d.children || [d];
8686
}).enter().append("rect").attr("class", "child").call(rect);
@@ -95,9 +95,12 @@ d3.json("whitematter.json", function(d) {
9595

9696
generateSankey(d);
9797

98-
function transition(d) {
9998

100-
focus = d;
99+
100+
101+
window.transition = function (d) {
102+
103+
d != undefined ? focus = d : d = focus;
101104

102105
generateSankey(d);
103106

@@ -141,7 +144,7 @@ d3.json("whitematter.json", function(d) {
141144
});
142145
}
143146
return g;
144-
}
147+
};
145148

146149
function text(text) {
147150
text.attr("x", function(d) {

0 commit comments

Comments
 (0)