Commit 73aad9a8 authored by Jehan's avatar Jehan

Merge pull request #236 from jtremback/flat

Heatmap containerization
parents f3b84e4b a4230eb0
...@@ -28,15 +28,6 @@ svg { -webkit-tap-highlight-color: rgba(255, 255, 255, 0); } ...@@ -28,15 +28,6 @@ svg { -webkit-tap-highlight-color: rgba(255, 255, 255, 0); }
visibility: hidden; visibility: hidden;
} }
.annotator-heatmap {
background: hsla(0, 0, 0, .1);
border: solid thin rgba($grayLighter, .4);
left: 17px;
height: 100%;
position: fixed;
top: 0;
width: $heatmap-width;
}
.sliding-panels > li { .sliding-panels > li {
...@@ -48,7 +39,6 @@ svg { -webkit-tap-highlight-color: rgba(255, 255, 255, 0); } ...@@ -48,7 +39,6 @@ svg { -webkit-tap-highlight-color: rgba(255, 255, 255, 0); }
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
padding: 1em; padding: 1em;
position: absolute; position: absolute;
height: 100%; height: 100%;
left: 0; left: 0;
right: 0; right: 0;
...@@ -82,7 +72,23 @@ svg { -webkit-tap-highlight-color: rgba(255, 255, 255, 0); } ...@@ -82,7 +72,23 @@ svg { -webkit-tap-highlight-color: rgba(255, 255, 255, 0); }
//HEATMAP POINTERS//////////////////////////////// //HEATMAP STUFF////////////////////////////////
.annotator-heatmap {
height: 100%;
position: fixed;
top: 0;
svg {
background: hsla(0, 0, 0, .1);
border: solid thin rgba($grayLighter, .4);
left: 17px;
height: 100%;
position: absolute;
top: 0;
width: $heatmap-width;
}
}
.heatmap-pointer { .heatmap-pointer {
@include user-select(none); @include user-select(none);
@include transition-property(left); @include transition-property(left);
...@@ -91,7 +97,7 @@ svg { -webkit-tap-highlight-color: rgba(255, 255, 255, 0); } ...@@ -91,7 +97,7 @@ svg { -webkit-tap-highlight-color: rgba(255, 255, 255, 0); }
// color: rgb(238, 238, 238); // color: rgb(238, 238, 238);
color: #666; color: #666;
left: 0px; left: 0px;
position: fixed; position: absolute;
height: 20.1px; height: 20.1px;
width: 40.1px; width: 40.1px;
vertical-align: middle; vertical-align: middle;
......
...@@ -22,7 +22,6 @@ class App ...@@ -22,7 +22,6 @@ class App
{plugins, provider} = annotator {plugins, provider} = annotator
heatmap = annotator.plugins.Heatmap heatmap = annotator.plugins.Heatmap
heatmap.element.appendTo $element heatmap.element.appendTo $element
# 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
...@@ -36,8 +35,12 @@ class App ...@@ -36,8 +35,12 @@ class App
hl hl
offset: offset offset: offset
heatmap.element.bind 'click', ->
$scope.$apply -> $location.path('/viewer').search(null).replace()
annotator.show()
heatmap.subscribe 'updated', => heatmap.subscribe 'updated', =>
tabs = d3.select(annotator.element[0]) tabs = d3.select(heatmap.element[0])
.selectAll('div.heatmap-pointer') .selectAll('div.heatmap-pointer')
.data => .data =>
buckets = [] buckets = []
...@@ -48,10 +51,6 @@ class App ...@@ -48,10 +51,6 @@ class App
buckets.push i buckets.push i
buckets buckets
heatmap.element.bind 'click', ->
$scope.$apply -> $location.path('/viewer').search(null).replace()
annotator.show()
{highlights, offset} = d3.select(heatmap.element[0]).datum() {highlights, offset} = d3.select(heatmap.element[0]).datum()
height = $(window).outerHeight(true) height = $(window).outerHeight(true)
pad = height * .2 pad = height * .2
...@@ -92,8 +91,8 @@ class App ...@@ -92,8 +91,8 @@ class App
provider.setActiveHighlights null provider.setActiveHighlights null
# Does one of a few things when a tab is clicked depending on type # Does one of a few things when a tab is clicked depending on type
.on 'mouseup', (bucket) => .on 'click', (bucket) =>
d3.event.preventDefault() d3.event.stopPropagation()
search = $location.search() or {} search = $location.search() or {}
search.bucket = bucket search.bucket = bucket
......
...@@ -5,22 +5,23 @@ class Annotator.Plugin.Heatmap extends Annotator.Plugin ...@@ -5,22 +5,23 @@ class Annotator.Plugin.Heatmap extends Annotator.Plugin
# heatmap svg skeleton # heatmap svg skeleton
html: """ html: """
<svg class="annotator-heatmap" <div class="annotator-heatmap">
xmlns="http://www.w3.org/2000/svg" <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
buckets: [] buckets: []
...@@ -49,7 +50,7 @@ class Annotator.Plugin.Heatmap extends Annotator.Plugin ...@@ -49,7 +50,7 @@ class Annotator.Plugin.Heatmap extends Annotator.Plugin
updateHeatmap: (data) => updateHeatmap: (data) =>
return unless d3? return unless d3?
wrapper = this.element.offsetParent() wrapper = this.element.offsetParent()
{highlights, offset} = data {highlights, offset} = data
...@@ -159,7 +160,7 @@ class Annotator.Plugin.Heatmap extends Annotator.Plugin ...@@ -159,7 +160,7 @@ class Annotator.Plugin.Heatmap extends Annotator.Plugin
opacity = d3.scale.pow().domain([0, max]).range([.1, .6]).exponent(2) opacity = d3.scale.pow().domain([0, max]).range([.1, .6]).exponent(2)
# d3 selections # d3 selections
stops = d3.select(@element[0]).datum(data) # cache highlights stops = d3.select(@element[0]).datum(data)
.select('#heatmap-gradient') .select('#heatmap-gradient')
.selectAll('stop').data(stopData, (d) => d) .selectAll('stop').data(stopData, (d) => d)
stops.enter().append('stop') stops.enter().append('stop')
......
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