Closed hsellik closed 1 year ago
I think I've come across this before. It looks like there's not much that can be done about out right now (given the way the zoom function currently works). Timeout might currently be your only workaround.
Some background: setAnnotations
is not an async function. The effect you're seeing is that setAnnotations
completes immediately, but the DOM update itself takes a while to process in the browser. The problem, now, is that fitAnnotations
fetches the annotation from the DOM, and then fits the viewport.
The only way to resolve this cleanly inside Annotorious would be to rewrite fitAnnotations
, to make it independent from the DOM. This way, zooming would work even before the annotation is actually rendered to the DOM. I'll leave that issue open, for the case that I get the chance to look into this soon-ish.
Alright, I see. Thanks for the quick response. :)
Hi,
I am trying to set annotations and then immediately zoom to those annotations. However, the await doesn't work for me properly.
Here's an example: https://stackblitz.com/edit/js-f2v3uc?file=index.js
If I use timeout, it works good, but it's not a preferred solution.
Any idea about what could be happening here?