Commit 1ff68e88 authored by Randall Leeds's avatar Randall Leeds

Anchor attempts happen in an animation frame

parent c42ee255
...@@ -151,10 +151,11 @@ module.exports = class Guest extends Annotator ...@@ -151,10 +151,11 @@ module.exports = class Guest extends Annotator
{anchored, unanchored, element, plugins} = this {anchored, unanchored, element, plugins} = this
maybeAnchor = (target) -> maybeAnchor = (target) ->
anchoring.anchor(target.selector) return new Promise(raf).then ->
.then(highlightRange) anchoring.anchor(target.selector)
.then((highlights) -> {annotation, target, highlights}) .then(highlightRange)
.catch((reason) -> {annotation, target, reason}) .then((highlights) -> {annotation, target, highlights})
.catch((reason) -> {annotation, target, reason})
highlightRange = (range) -> highlightRange = (range) ->
return new Promise(raf).then -> return new Promise(raf).then ->
......
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