Commit 67d87893 authored by Randall Leeds's avatar Randall Leeds

Restore highlight events

parent e69eff91
...@@ -15,6 +15,9 @@ module.exports = class Guest extends Annotator ...@@ -15,6 +15,9 @@ module.exports = class Guest extends Annotator
".annotator-adder button click": "onAdderClick" ".annotator-adder button click": "onAdderClick"
".annotator-adder button mousedown": "onAdderMousedown" ".annotator-adder button mousedown": "onAdderMousedown"
".annotator-adder button mouseup": "onAdderMouseup" ".annotator-adder button mouseup": "onAdderMouseup"
".annotator-hl click": "onHighlightClick"
".annotator-hl mouseover": "onHighlightMouseover"
".annotator-hl mouseout": "onHighlightMouseout"
"setVisibleHighlights": "setVisibleHighlights" "setVisibleHighlights": "setVisibleHighlights"
# Plugin configuration # Plugin configuration
...@@ -233,8 +236,6 @@ module.exports = class Guest extends Annotator ...@@ -233,8 +236,6 @@ module.exports = class Guest extends Annotator
method: "focusAnnotations" method: "focusAnnotations"
params: (a.$$tag for a in annotations) params: (a.$$tag for a in annotations)
onAnchorMousedown: ->
onSuccessfulSelection: (event, immediate) -> onSuccessfulSelection: (event, immediate) ->
unless event? unless event?
throw "Called onSuccessfulSelection without an event!" throw "Called onSuccessfulSelection without an event!"
...@@ -272,25 +273,28 @@ module.exports = class Guest extends Annotator ...@@ -272,25 +273,28 @@ module.exports = class Guest extends Annotator
this.triggerShowFrame() this.triggerShowFrame()
this.showAnnotations annotations this.showAnnotations annotations
# When Mousing over a highlight, tell the sidebar to focus the relevant annotations onHighlightMouseover: (event) ->
onAnchorMouseover: (event) ->
if @visibleHighlights if @visibleHighlights
event.stopPropagation() event.stopPropagation()
annotations = event.data.getAnnotations(event) annotations = []
for obj in @anchored
if event.target in obj.highlights
annotations.push(obj.annotation)
this.focusAnnotations annotations this.focusAnnotations annotations
# Tell the sidebar to stop highlighting the relevant annotations onHighlightMouseout: (event) ->
onAnchorMouseout: (event) ->
if @visibleHighlights if @visibleHighlights
event.stopPropagation() event.stopPropagation()
this.focusAnnotations [] this.focusAnnotations []
# When clicking on a highlight, tell the sidebar to bring up the viewer for the relevant annotations onHighlightClick: (event) =>
onAnchorClick: (event) =>
if @visibleHighlights if @visibleHighlights
event.stopPropagation() event.stopPropagation()
this.selectAnnotations (event.data.getAnnotations event), annotations = []
(event.metaKey or event.ctrlKey) for obj in @anchored
if event.target in obj.highlights
annotations.push(obj.annotation)
this.selectAnnotations annotations, (event.metaKey or event.ctrlKey)
# Pass true to show the highlights in the frame or false to disable. # Pass true to show the highlights in the frame or false to disable.
setVisibleHighlights: (shouldShowHighlights) -> setVisibleHighlights: (shouldShowHighlights) ->
......
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