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 42 forks source link

selection A not highlighted directly after creating or updating selection B when disabledEditor=true #138

Closed geoffroy-noel-ddh closed 2 years ago

geoffroy-noel-ddh commented 2 years ago

I assume the following result is a bug.

Step to reproduce

https://jsfiddle.net/71856gxy/2/

  1. Draw a box
  2. Draw a second box
  3. Click the first box

Expected result

The first box should be selected and highlighted (i.e. yellow border, black circle in the four corners).

Result

The first box is selected but not highlighted. The user has to click it again to be highlighted.

Notes

  1. In step 3, the first box is first highlighted then almost immediately loses its highlight.
  2. Although I can't reproduce it in this demo, in my local app this issue also occurs when clicking a box just after resizing or updating another one previously created
geoffroy-noel-ddh commented 2 years ago

Is there a work around for this?

rsimon commented 2 years ago

Hi, thanks, I can reproduce. Hm, not exactly a bug I'd say, but just how the behavior works right now ;-) (Click outside works as a 'Save' action, but doesn't do anything else.) But I agree: the expected behavior would be that the first box gets selected instantly.

The event flow has gotten a bit complicated in the AnnotationLayer and Annotator classes. I'll need to find a bit more time to properly debug and change this.

I'm afraid there's no workaround I can see for this off the top of my head. (I think the onAnnotationEnter/Leave events might still work, so you might be able to track the current hover yourself, and then programmatically select. But this might get messy...)

geoffroy-noel-ddh commented 2 years ago

Thanks. I'll take any possible workaround for the time being as it would really help streamline the annotating workflow for our researchers!

And just to clarify, I believe the first annotation is actually selected (i.e. anno.getSelected() returns it & selectAnnotation event also fires) but the actual highlight disappears somehow.

rsimon commented 2 years ago

The last commit (7924785dce9a35c236e8720ec37113c530a92ba1) should fix this. It will need a bit more testing to ensure this doesn't have any unwanted side-effects. But otherwise should be ok now!

geoffroy-noel-ddh commented 2 years ago

Brilliant, thank you very much. I'll test that on Monday.

geoffroy-noel-ddh commented 2 years ago

Working as expected now with the new version. Thanks again for fixing it so quickly.