From 563ddecafb9d0dfd783cabc35ceb28c3d8d60f59 Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Mon, 12 Jan 2015 02:36:11 +0000 Subject: tip only needs initializing once --- html/js/git-deps-graph.coffee | 13 +++++++------ 1 file 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) -- cgit