diff options
author | Adam Spiers <git@adamspiers.org> | 2015-01-12 02:36:11 +0000 |
---|---|---|
committer | Adam Spiers <git@adamspiers.org> | 2015-01-12 02:36:11 +0000 |
commit | 563ddecafb9d0dfd783cabc35ceb28c3d8d60f59 (patch) | |
tree | dfe26b9c7b7bd3c0b36fecaaa469703e8beda172 /html | |
parent | 29fc2d2985403f9cd6730a9e5f775b01b8d89e09 (diff) | |
download | git-deps-563ddecafb9d0dfd783cabc35ceb28c3d8d60f59.tar.gz |
tip only needs initializing once
Diffstat (limited to 'html')
-rw-r--r-- | html/js/git-deps-graph.coffee | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/html/js/git-deps-graph.coffee b/html/js/git-deps-graph.coffee index adb78b7..202487d 100644 --- a/html/js/git-deps-graph.coffee +++ b/html/js/git-deps-graph.coffee @@ -204,8 +204,15 @@ draw_graph = (commitish) -> # d.y = n.y; # }); + init_tip() unless tip? draw_nodes fg, nodes +init_tip = () -> + tip = d3.tip().attr("class", "d3-tip").html(tip_html) + fg.call tip + hide_tip_on_drag = d3cola.drag().on("dragstart", tip.hide) + nodes.call hide_tip_on_drag + # Required for object constancy: http://bost.ocks.org/mike/constancy/ ... link_key = (link) -> source = sha1_of_link_pointer(link.source) @@ -289,12 +296,6 @@ explore_node = (d) -> add_commitish d.sha1 draw_nodes = (fg, nodes) -> - # Initialize tooltip - tip = d3.tip().attr("class", "d3-tip").html(tip_html) - fg.call tip - hide_tip_on_drag = d3cola.drag().on("dragstart", tip.hide) - nodes.call hide_tip_on_drag - rect = nodes.append("rect") .attr("rx", 5) .attr("ry", 5) |