Coder Social home page Coder Social logo

Comments (4)

oleksandr-danylchenko avatar oleksandr-danylchenko commented on June 14, 2024 1

Oh-oh... I think this issue appeared in the 1st place because I was using the Annotorious + TextAnnotator components in a wrong way... 👁️👁️👁️

I was trying to use the same annotator instance across mutliple pages at the same time. I thought that I can use filter to display only relevant annotations on a certain page, but I didn't consider that filter doens't remove the annos from the positions recalculation! So each page change my customly made ranges were getting needlesly revived on irrelevant content and destroyed 🤯
And I haven't mentioned the jittering that was happening on a page change when the filter was trying to remove the old highligths and display the new ones not quickly enough...
Morevover, that approach didn't allow me to use a static plugin, leading to all sorts of magic I described above...

So... The solution I found was to force the re-render of the Annotorious! It destroy the annotator instance and allows each page work with the annotator from scratch! No more monkey patching of the already monkey patched methods or redundant revivals 🎉

from annotorious.

rsimon avatar rsimon commented on June 14, 2024 1

Ah - sorry. Need to find some time later to read through this in detail. Just briefly (if this is of interest at all!). If you need to work with multiple anno instances in parallel - register common selection or lifecycle handlers, delete/update annotations regardless on which annotator they live etc. - there's a utility that can handle most of the plumbing for you:
https://github.com/annotorious/annotorious/tree/main/packages/annotorious-react-manifold

But as I said: not sure if this is even a use case for you.

from annotorious.

oleksandr-danylchenko avatar oleksandr-danylchenko commented on June 14, 2024 1

Fortunately, I think that having just a single annotator instance per page should be enought. And it makes the code more straightforward anyway 😅

from annotorious.

oleksandr-danylchenko avatar oleksandr-danylchenko commented on June 14, 2024

I was just wondering "why does the A9S have 2 React implementations?" 😅
But turns out the manifold should be used for handle multiple annotator instances instead...

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.