Commit 20334a06 authored by Randall Leeds's avatar Randall Leeds

Add clarify comments about event bubbling

parent 52e25cd1
...@@ -369,6 +369,11 @@ module.exports = class Guest extends Annotator ...@@ -369,6 +369,11 @@ module.exports = class Guest extends Annotator
annotation = $(event.currentTarget).data('annotation') annotation = $(event.currentTarget).data('annotation')
annotations = event.annotations ?= [] annotations = event.annotations ?= []
annotations.push(annotation) annotations.push(annotation)
# The innermost highlight will execute this.
# The timeout gives time for the event to bubble, letting any overlapping
# highlights have time to add their annotations to the list stored on the
# event object.
if event.target is event.currentTarget if event.target is event.currentTarget
setTimeout => this.focusAnnotations(annotations) setTimeout => this.focusAnnotations(annotations)
...@@ -381,6 +386,8 @@ module.exports = class Guest extends Annotator ...@@ -381,6 +386,8 @@ module.exports = class Guest extends Annotator
annotation = $(event.currentTarget).data('annotation') annotation = $(event.currentTarget).data('annotation')
annotations = event.annotations ?= [] annotations = event.annotations ?= []
annotations.push(annotation) annotations.push(annotation)
# See the comment in onHighlightMouseover
if event.target is event.currentTarget if event.target is event.currentTarget
xor = (event.metaKey or event.ctrlKey) xor = (event.metaKey or event.ctrlKey)
setTimeout => this.selectAnnotations(annotations, xor) setTimeout => this.selectAnnotations(annotations, xor)
......
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