Commit 81807551 authored by Randall Leeds's avatar Randall Leeds

Merge pull request #1729 from hypothesis/1728-drop-shadows

Re-implement hiliting annotation cards on hover
parents eae9958d c50817f8
...@@ -353,6 +353,8 @@ class ViewerController ...@@ -353,6 +353,8 @@ class ViewerController
else else
true true
$scope.isFocused = (annotation) ->
annotation?.$$tag in ($scope.focusedAnnotations ? [])
angular.module('h') angular.module('h')
.controller('AppController', AppController) .controller('AppController', AppController)
......
...@@ -250,8 +250,11 @@ class Annotator.Guest extends Annotator ...@@ -250,8 +250,11 @@ class Annotator.Guest extends Annotator
method: "showEditor" method: "showEditor"
params: annotation.$$tag params: annotation.$$tag
onAnchorMouseover: -> focusInViewer: (annotations) =>
onAnchorMouseout: -> @panel?.notify
method: "setViewerFocus"
params: (a.$$tag for a in annotations)
onAnchorMousedown: -> onAnchorMousedown: ->
checkForStartSelection: (event) => checkForStartSelection: (event) =>
...@@ -294,6 +297,21 @@ class Annotator.Guest extends Annotator ...@@ -294,6 +297,21 @@ class Annotator.Guest extends Annotator
# Tell sidebar to show the viewer for these annotations # Tell sidebar to show the viewer for these annotations
this.showViewer annotations this.showViewer annotations
# When hovering on a highlight in highlighting mode,
# tell the sidebar to hilite the relevant annotations
onAnchorMouseover: (event) ->
if @visibleHighlights or @tool is 'highlight'
event.stopPropagation()
annotations = event.data.getAnnotations(event)
this.focusInViewer annotations
# When leaving a highlight (with the cursor) in highlighting mode,
# tell the sidebar to stop hiliting the relevant annotations
onAnchorMouseout: (event) ->
if @visibleHighlights or @tool is 'highlight'
event.stopPropagation()
this.focusInViewer []
# When clicking on a highlight in highlighting mode, # When clicking on a highlight in highlighting mode,
# tell the sidebar to bring up the viewer for the relevant annotations # tell the sidebar to bring up the viewer for the relevant annotations
onAnchorClick: (event) => onAnchorClick: (event) =>
......
...@@ -164,6 +164,11 @@ class Hypothesis extends Annotator ...@@ -164,6 +164,11 @@ class Hypothesis extends Annotator
this.updateViewer this._getLocalAnnotations(tags) this.updateViewer this._getLocalAnnotations(tags)
) )
.bind('setViewerFocus', (ctx, tags=[]) =>
@element.scope().$apply =>
this.setViewerFocus tags
)
.bind('toggleViewerSelection', (ctx, tags=[]) => .bind('toggleViewerSelection', (ctx, tags=[]) =>
@element.scope().$apply => @element.scope().$apply =>
this.toggleViewerSelection this._getLocalAnnotations(tags) this.toggleViewerSelection this._getLocalAnnotations(tags)
...@@ -231,6 +236,9 @@ class Hypothesis extends Annotator ...@@ -231,6 +236,9 @@ class Hypothesis extends Annotator
@_setSelectedAnnotations selected @_setSelectedAnnotations selected
this this
setViewerFocus: (tags) ->
@element.scope().focusedAnnotations = tags
updateViewer: (annotations=[]) -> updateViewer: (annotations=[]) ->
# TODO: re-implement # TODO: re-implement
this this
......
...@@ -6,8 +6,9 @@ $threadexp-width: .6em; ...@@ -6,8 +6,9 @@ $threadexp-width: .6em;
margin-bottom: .72em; margin-bottom: .72em;
} }
.card-emphasis { & > li.thread:hover,
box-shadow: 6px 6px 8px -2px $gray-light; & > li.thread.js-hover {
@include focus-outline;
} }
} }
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
</span> </span>
</li> </li>
<li class="paper thread" <li class="paper thread"
ng-class="{'js-hover': isFocused(child.message)}"
deep-count="count" deep-count="count"
thread="child" thread-filter thread="child" thread-filter
thread-collapsed="!search.query" thread-collapsed="!search.query"
......
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