Commit 77503e7a authored by Randall Leeds's avatar Randall Leeds

track frame visibility only in the scope

fixes #376
parent 384bf038
class App class App
scope: scope:
frame:
visible: false
username: null username: null
email: null email: null
password: null password: null
...@@ -39,7 +41,8 @@ class App ...@@ -39,7 +41,8 @@ class App
{highlights, offset} = elem.datum() {highlights, offset} = elem.datum()
if dynamicBucket and $location.path() == '/viewer' and annotator.visible visible = $scope.frame.visible
if dynamicBucket and visible and $location.path() == '/viewer'
bottom = offset + heatmap.element.height() bottom = offset + heatmap.element.height()
annotations = highlights.reduce (acc, hl) => annotations = highlights.reduce (acc, hl) =>
if hl.offset.top >= offset and hl.offset.top <= bottom if hl.offset.top >= offset and hl.offset.top <= bottom
...@@ -151,7 +154,7 @@ class App ...@@ -151,7 +154,7 @@ class App
annotator.plugins.Store.pluginInit() annotator.plugins.Store.pluginInit()
dynamicBucket = true dynamicBucket = true
$scope.$watch 'visible', (newValue) -> $scope.$watch 'frame.visible', (newValue) ->
if newValue then annotator.show() else annotator.hide() if newValue then annotator.show() else annotator.hide()
$scope.$on 'back', -> $scope.$on 'back', ->
...@@ -159,7 +162,7 @@ class App ...@@ -159,7 +162,7 @@ class App
if $location.path() == '/viewer' and $location.search()?.id? if $location.path() == '/viewer' and $location.search()?.id?
$location.search('id', null).replace() $location.search('id', null).replace()
else else
$scope.visible = false annotator.hide()
$scope.$on 'showAuth', (event, show=true) -> $scope.$on 'showAuth', (event, show=true) ->
angular.extend $scope.sheet, angular.extend $scope.sheet,
...@@ -331,7 +334,7 @@ class Viewer ...@@ -331,7 +334,7 @@ class Viewer
listening = false listening = false
refresh = => refresh = =>
return unless annotator.visible return unless $scope.frame.visible
this.refresh $scope, $routeParams, annotator this.refresh $scope, $routeParams, annotator
if listening if listening
if $scope.detail if $scope.detail
......
...@@ -40,7 +40,6 @@ class Hypothesis extends Annotator ...@@ -40,7 +40,6 @@ class Hypothesis extends Annotator
Threading: {} Threading: {}
# Internal state # Internal state
visible: false # * Whether the sidebar is visible
dragging: false # * To enable dragging only when we really want to dragging: false # * To enable dragging only when we really want to
# Here as a noop just to make the Permissions plugin happy # Here as a noop just to make the Permissions plugin happy
...@@ -284,14 +283,14 @@ class Hypothesis extends Annotator ...@@ -284,14 +283,14 @@ class Hypothesis extends Annotator
this this
show: => show: =>
@visible = true @element.scope().frame.visible = true
@provider.notify method: 'showFrame' @provider.notify method: 'showFrame'
@element.find('#toolbar').addClass('shown') @element.find('#toolbar').addClass('shown')
.find('.tri').attr('draggable', true) .find('.tri').attr('draggable', true)
hide: => hide: =>
@lastWidth = window.innerWidth @lastWidth = window.innerWidth
@visible = false @element.scope().frame.visible = false
@provider.notify method: 'setActiveHighlights' @provider.notify method: 'setActiveHighlights'
@provider.notify method: 'hideFrame' @provider.notify method: 'hideFrame'
@element.find('#toolbar').removeClass('shown') @element.find('#toolbar').removeClass('shown')
......
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