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

Problems with sorting shapes #68

Closed erikradisch closed 3 years ago

erikradisch commented 3 years ago

Shapes are not always sorted as expected. See, for example http://kuchatest.saw-leipzig.de/depiction/136 (I send the pw per pm). I implemented a show on hover behavior. However, several shapes with less area are sorted before a huge one and therefore not shown.

rsimon commented 3 years ago

Hi @erikradisch,

first off: the effect looks great! I think I need to incorprate that into the main codebase, too, somehow :-)

Hm, yes, the shapes are supposed to be sorted by area, so that the smallest one is always on top. I noticed that the annotations in your case are not <polygon>s, however. But <path>s. I assume they were created by your multi-polygon extension?

The recent Annotorious releases only contained area computation for <rect>s and <polygons>. I think they would have raised an exception for <path> shapes. Did you make any changes to the EmbeddedSVG class to avoid this? If so, what does your area computation code look like?

The latest release did add area computation code for paths. I think it might have problems dealing with multi-polygon shapes, but should handle single (closed or open) paths. If you're not using the latest release yet, upgrading might also help.

erikradisch commented 3 years ago

Sure! I forgot to adjust the algorithm for calculating the areas!!! thanks for that tip! That did already the trick!!