Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight issue - note icon location #214

Open
mrifni opened this issue Aug 10, 2021 · 1 comment
Open

Highlight issue - note icon location #214

mrifni opened this issue Aug 10, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@mrifni
Copy link
Contributor

mrifni commented Aug 10, 2021

What happened?

Tried to highlight multiple words and note icon shows fine first time. But occasionally when open the book multiple times icon renders on the text itself.

How to reproduce?

Add a highlight and close and open the book few times.

Environment

Latest develop branch

Development environment

  • OS: macos
  • IDE: Android studio arctic fox

Testing device

  • Android version: 10
  • Model: One Plus 5
  • Is it an emulator? No
@mickael-menu mickael-menu added the bug Something isn't working label Aug 10, 2021
@mickael-menu
Copy link
Member

I guess this could happen if the resource is not fully laid out before applying the highlights. I added a requestAnimationFrame but it's not a silver bullet.

// Using requestAnimationFrame helps to make sure the page is fully laid out before adding the
// decorations.
requestAnimationFrame(function () {
    let group = readium.getDecorations('highlights');
    group.update({"id":"16-highlight","locator":{"href":"\/OPS\/title.xml","type":"application\/xhtml+xml","locations":{"progression":0,"position":2,"totalProgression":0.0033444816053511705},"text":{"before":"The ","highlight":"Great","after":" Gatsby\nFrancis Scott Fitzgerald\n\n\nPublished: 1925\nCategorie(s): Fiction, Literary, Romance\nSource: http:\/\/ebooks.adelaide.edu.au"}},"style":"org.readium.r2.navigator.Decoration.Style.Highlight","element":"\n                    <div class=\"r2-highlight-3\" style=\"background-color: rgba(240, 186, 50, 0.3) !important;\"\/>\"\n                    "});
});

That's a complicated problem and I don't really have a solution at the moment. We could wait more but that's a band-aid and can also give a poor user experience.

@mickael-menu mickael-menu transferred this issue from readium/r2-testapp-kotlin Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants