Commit 1cc8e3c9 authored by csillag's avatar csillag

Simplify annotation card focusing logic

Don't bother looking up the annotations (for the tags),
since we only need the list of tags anyway.

(It was different when we worked with the IDs, but we
moved to use tags instead, so the actual annotations
are no longer needed.)
parent 6c1369bc
......@@ -166,8 +166,7 @@ class Hypothesis extends Annotator
.bind('setFocusState', (ctx, data) =>
@element.scope().$apply =>
annotations = this._getLocalAnnotations data.tags
this.setViewerFocusState annotations, data.state
this.setViewerFocusState data.tags, data.state
)
.bind('toggleViewerSelection', (ctx, tags=[]) =>
......@@ -237,14 +236,14 @@ class Hypothesis extends Annotator
@_setSelectedAnnotations selected
this
setViewerFocusState: (annotations, state) ->
setViewerFocusState: (tags, state) ->
scope = @element.scope()
focused = scope.focusedAnnotations ?= {}
for a in annotations
for tag in tags
if state
focused[a.$$tag] = true
focused[tag] = true
else
delete focused[a.$$tag]
delete focused[tag]
this
updateViewer: (annotations=[]) ->
......
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