-
Notifications
You must be signed in to change notification settings - Fork 47
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
fix(missing-annotations): Fix annotations on zoom issue #701
Conversation
managers.forEach(manager => { | ||
if (!manager.exists(pageEl)) { | ||
destroyManagers = true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the third manager in the list doesn't exist but there are 6 managers. That means the first 2 won't get destroyed. Is that the behavior we want?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah my mistake, updated. Good catch.
src/document/DocumentAnnotator.ts
Outdated
manager.destroy(); | ||
}); | ||
managers.clear(); | ||
destroyManagers = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if we don't reset the destroyManagers values here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be the same result, but I don't see any downsides to resetting the value since it should not be true anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea it should have no effects but it's not needed though because the value won't be used again after that. Resetting it makes it seem like that value is relevant even after we clear the managers.
Due to changes in PDFjs v3.6.172, annotations would dissapear upon zooming in/out on the pdf. This is because the page elements that our annotation managers were referencing would be removed when zooming in/out. The textLayer pdfJS uses would not be removed however, which would make one of our managers not get cleaned up. In order to reinstantiate our managers, we need all managers to be cleaned up. Because of our current logic for adding managers, we need to make sure every manager is cleaned up when at least one manager is cleaned up. Which makes sense since the annotation managers are coupled together and cannot function correctly without the others.
Annotation Drawing mode
Annotation Highlight mode