annotorious / annotorious-openseadragon

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

getAnnotations during active selection returns selected annotation twice #63

Closed umesh-timalsina closed 3 years ago

umesh-timalsina commented 3 years ago

Not sure if this has been raised before, but the following snippet will return two nodes for the selected annotation. Upon inspection, there's no duplicate shape but the dynamic class change to editable selected might be causing the issue? https://github.com/recogito/annotorious-openseadragon/blob/c256d59590e69e1f252d592c297a7b229740e60d/src/OSDAnnotationLayer.js#L215-L218

rsimon commented 3 years ago

Yikes, no I missed that. Thanks for reporting. I'll look into it.

rsimon commented 3 years ago

An interesting dependecy :-) Couldn't reproduce at first - it happend only when calling getAnnotations() in the selectAnnotation event handler. It was a timing issue because of a recent change to fix another (and completely different) issue: https://github.com/recogito/annotorious-openseadragon/issues/44

When selecting an annotation, the original shape gets replaced with an editable version. Because the fix to #44 deferred the removal of the original shape after the event trigger, there were indeed to copies of the annotation on the annotation layer when the handler got called.

Fixed now!