Coder Social home page Coder Social logo

Comments (5)

kennysong avatar kennysong commented on June 15, 2024 1

Thanks for the quick reply! Your explanation of how the ordering algorithm works was quite helpful.

We found a workaround by re-ordering a selected annotation to the "top" of the SVG so the label is always visible (and reseting it to its original position when deselecting). This preserves clickability and readability in our use case.

from annotorious.

rsimon avatar rsimon commented on June 15, 2024

Hi!

Thanks! Yes, the shuffling is intentional - and I'm afraid there's no way to change it in Annotorious, except by forking it.

Annotorious sorts the shapes by size, and then stacks them so that the largest shape is at the bottom (added to the SVG first), and the smallest shape is at the top (added last). This way, no large shape will overlap a smaller shape, and all the shapes remain clickable.

If forking is an option for you, however: the change would be fairly minimal, I believe. Shouldn't take much more than commenting out this section in the annotation layer (or, alternatively, remove every call to redraw()).

The other alternative would be to switch to the OpenSeadragon version of Annotorious. This doesn't do any reshuffling, because it handles hit/hover detection in a different way (by querying a spatial index instead of relying on mouse events.)

Hope this helps!

from annotorious.

kennysong avatar kennysong commented on June 15, 2024

Hi @rsimon, quick follow-up question:

We switched to the OpenSeadragon version of Annotorious to be able to use zooming. You mentioned that

it handles hit/hover detection in a different way (by querying a spatial index instead of relying on mouse events.)

I just wanted to confirm that the order of .a9s-annotation elements in the SVG no longer affects hovering and clicking? This seems to be the behavior we observed during testing.

from annotorious.

rsimon avatar rsimon commented on June 15, 2024

Hi, yes that's right. The order of the SVG elements in the DOM is irrelevant to hit detection in the OSD version.

from annotorious.

kennysong avatar kennysong commented on June 15, 2024

Thanks for confirming! This is really useful, we no longer need to reset annotations "to its original position when deselecting" anymore.

from annotorious.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.