Commit 1114acdf authored by Randall Leeds's avatar Randall Leeds

inline a small callback

parent c06955e5
......@@ -56,7 +56,11 @@ class Hypothesis extends Annotator
_setupHeatmap: () ->
# Pull the heatmap into the sidebar
@heatmap = @plugins.Heatmap
d3.select(@heatmap.element.get(0)).on('click', this.onHeatmapClick)
d3.select(@heatmap.element.get(0)).on 'click', =>
[x, y] = d3.mouse(d3.event.target)
target = d3.bisect(@heatmap.index, y)-1
annotations = @heatmap.buckets[target]
this.showViewer(annotations) if annotations?.length
this
# Creates an instance of Annotator.Viewer and assigns it to the @viewer
......@@ -140,12 +144,6 @@ class Hypothesis extends Annotator
annotation.ranges = annotation.ranges or []
super annotation, args...
onHeatmapClick: () =>
[x, y] = d3.mouse(d3.event.target)
target = d3.bisect(@heatmap.index, y)-1
annotations = @heatmap.buckets[target]
this.showViewer(annotations) if annotations?.length
showViewer: (annotations=[], detail=false) ->
viewer = d3.select(@viewer.element.get(0))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment