diff options
| author | Alon Levy <alon@pobox.com> | 2015-05-12 12:53:17 +0300 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2015-05-12 12:53:17 +0300 |
| commit | ff510e97dcd1c60f68e06565c51b63f4a3e96f63 (patch) | |
| tree | e7a444e57467c21a4bae85a99a3b5a30bc8bfab5 /src/client | |
| parent | 7363094b454caa55d69acc95a3f0af70e0bd5e0e (diff) | |
client/view/graph_view: factor out link__hover__{start,end}
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/view/graph_view.js | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/client/view/graph_view.js b/src/client/view/graph_view.js index a1a2fe1d..ae29107e 100644 --- a/src/client/view/graph_view.js +++ b/src/client/view/graph_view.js @@ -510,19 +510,30 @@ function GraphView(spec) { }); } + /* + * @this - the element being hovered on. Could use d.id instead + */ + var link__hover__start = function (d) { + add_class(this, 'hovering'); + // show text if not selected + if (!selection.link_related(d)) { + set_link_label_text(this.id, link_text__short(d)); + } + } + + var link__hover__end = function (d) { + remove_class(this, 'hovering'); + // hide text if not selected + if (!selection.link_related(d)) { + set_link_label_text(this.id, ""); + } + } + var link_on_hover = function (d, debug_name) { $('#' + d.id).hover(function (e) { - add_class(this, 'hovering'); - // show text if not selected - if (!selection.link_related(d)) { - set_link_label_text(this.id, link_text__short(d)); - } + link__hover__start.call(this, d); }, function (e) { - remove_class(this, 'hovering'); - // hide text if not selected - if (!selection.link_related(d)) { - set_link_label_text(this.id, ""); - } + link__hover__end.call(this, d); }); } |
