Commit 29006cd7 authored by csillag's avatar csillag

Tune dynamic bucket mode according to search state.

- When entering page search, disable dynamic bucket mode
- When leaveing page search, enable dynamic bucket mode

Fixes #790.
parent 278524c1
......@@ -157,6 +157,11 @@ class App
@visualSearch.searchBox.disableFacets();
@visualSearch.searchBox.value('');
@visualSearch.searchBox.flags.allSelected = false;
# Set host/guests into dynamic bucket mode
for p in annotator.providers
p.channel.notify
method: 'setDynamicBucketMode'
params: true
$scope.$on '$routeChangeStart', (current, next) ->
return unless next.$$route?
......@@ -343,6 +348,14 @@ class App
in_body_text: in_body_text
quote: quote_search
$location.path('/page_search').search(search)
unless $scope.inSearch # If we are entering search right now
# Turn dynamic bucket mode off for host/guests
for p in annotator.providers
p.channel.notify
method: 'setDynamicBucketMode'
params: false
$rootScope.$digest()
facetMatches: (callback) =>
......
......@@ -63,6 +63,11 @@ class Annotator.Guest extends Annotator
.bind('onEditorHide', this.onEditorHide)
.bind('onEditorSubmit', this.onEditorSubmit)
.bind('setDynamicBucketMode', (ctx, value) =>
this.plugins.Heatmap.dynamicBucket = value
if value then this.plugins.Heatmap._update()
)
.bind('setActiveHighlights', (ctx, tags=[]) =>
@wrapper.find('.annotator-hl')
.each ->
......
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