annotorious / annotorious-openseadragon

An OpenSeadragon plugin for annotating high-res zoomable images
https://annotorious.github.io
BSD 3-Clause "New" or "Revised" License
121 stars 42 forks source link

clearAnnotations() not working properly #125

Closed hsellik closed 2 years ago

hsellik commented 2 years ago

Hi

Whenever I try to clear annotations and add a new set of annotations I get a weird bug. When I hover over the image, the annotations seem to be highlighted randomly. Same applies to clicking. See the annotation highlighting on the right, when the mouse is hovering a seemingly random place:

random_highlight

I thought clearing annotations would "reset" everything. Right now my solution is to create new instance of annotorious, which works fine actually. Just wanted to see if this is a bug or not.

Also, await did not seem to work for me properly, so I used timeouts instead.

I created an example in StackBlitz: editor: https://stackblitz.com/edit/js-sgvmsm?file=index.js application: https://js-sgvmsm.stackblitz.io

rsimon commented 2 years ago

Yikes - this issue was actually reported recently on the Gitter chat, if I remember correctly. But then no issue was created yet, and it dropped of my list.

Yes, it's a bug in Annotorious. (But only affects the OpenSeadragon version.) Specifically, there's some code missing (around here) which would need to clear the spatial index that's handling the mouseovers. I'll look into it for the next release!