Commit ab6b5703 authored by Jehan Tremback's avatar Jehan Tremback

put heatmap into container

parent 4fed7317
...@@ -30,15 +30,13 @@ svg { -webkit-tap-highlight-color: rgba(255, 255, 255, 0); } ...@@ -30,15 +30,13 @@ svg { -webkit-tap-highlight-color: rgba(255, 255, 255, 0); }
} }
.annotator-heatmap { .annotator-heatmap {
svg { background: hsla(0, 0, 0, .1);
background: hsla(0, 0, 0, .1); border: solid thin rgba($grayLighter, .4);
border: solid thin rgba($grayLighter, .4); left: 17px;
left: 17px; height: 100%;
height: 100%; position: fixed;
position: fixed; top: 0;
top: 0; width: $heatmap-width;
width: $heatmap-width;
}
} }
......
...@@ -9,8 +9,7 @@ class App ...@@ -9,8 +9,7 @@ class App
) -> ) ->
{plugins, provider} = annotator {plugins, provider} = annotator
heatmap = annotator.plugins.Heatmap heatmap = annotator.plugins.Heatmap
heatmap.element.appendTo $element heatmap.element.appendTo '#heatmap-container'
# Update the heatmap when the host is updated or annotations are loaded # Update the heatmap when the host is updated or annotations are loaded
events = ['hostUpdated', 'annotationsLoaded'] events = ['hostUpdated', 'annotationsLoaded']
for event in events for event in events
......
...@@ -5,23 +5,21 @@ class Annotator.Plugin.Heatmap extends Annotator.Plugin ...@@ -5,23 +5,21 @@ class Annotator.Plugin.Heatmap extends Annotator.Plugin
# heatmap svg skeleton # heatmap svg skeleton
html: """ html: """
<div class="annotator-heatmap"> <svg class="annotator-heatmap"
<svg xmlns="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" version="1.1">
version="1.1"> <defs>
<defs> <linearGradient id="heatmap-gradient" x2="0" y2="100%">
<linearGradient id="heatmap-gradient" x2="0" y2="100%"> </linearGradient>
</linearGradient> <filter id="heatmap-blur">
<filter id="heatmap-blur"> <feGaussianBlur stdDeviation="0 2"></feGaussianBlur>
<feGaussianBlur stdDeviation="0 2"></feGaussianBlur> </filter>
</filter> </defs>
</defs> <rect x="0" y="0" width="100%" height="100%"
<rect x="0" y="0" width="100%" height="100%" fill="url('#heatmap-gradient')"
fill="url('#heatmap-gradient')" filter="url('#heatmap-blur')" >
filter="url('#heatmap-blur')" > </rect>
</rect> </svg>
</svg>
</div>
""" """
# buckets of annotations that overlap # buckets of annotations that overlap
...@@ -50,9 +48,9 @@ class Annotator.Plugin.Heatmap extends Annotator.Plugin ...@@ -50,9 +48,9 @@ class Annotator.Plugin.Heatmap extends Annotator.Plugin
d3.hcl(270, c(v), l(v)).toString() d3.hcl(270, c(v), l(v)).toString()
updateHeatmap: (data) => updateHeatmap: (data) =>
# debugger
return unless d3? return unless d3?
wrapper = this.element.parents("body")
wrapper = this.element.offsetParent()
{highlights, offset} = data {highlights, offset} = data
# Keep track of buckets of annotations above and below the viewport # Keep track of buckets of annotations above and below the viewport
......
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