Skip to content

Commit

Permalink
Guard against JS error by rendering arrows only if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Or committed May 6, 2015
1 parent f23e15b commit 3c0d4f0
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,13 @@ function drawCrossStageEdges(edges, svgContainer) {
}
// Now draw the arrows by borrowing the arrow marker generated by dagre-d3
var dagreD3Marker = svgContainer.select("g.edgePaths marker").node();
svgContainer
.append(function() { return dagreD3Marker.cloneNode(true); })
.attr("id", "marker-arrow")
svgContainer.selectAll("g > path").attr("marker-end", "url(#marker-arrow)");
svgContainer.selectAll("g.edgePaths def").remove(); // We no longer need these
if (!dagreD3Marker.empty()) {
svgContainer
.append(function() { return dagreD3Marker.cloneNode(true); })
.attr("id", "marker-arrow")
svgContainer.selectAll("g > path").attr("marker-end", "url(#marker-arrow)");
svgContainer.selectAll("g.edgePaths def").remove(); // We no longer need these
}
}

/*
Expand Down

0 comments on commit 3c0d4f0

Please sign in to comment.