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

Redraw highlight divs when the viewport is resized #159

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

jansc
Copy link
Contributor

@jansc jansc commented Feb 27, 2015

When the viewport of the cloud reader is resized, the highlights show up at apparently random locations. This is because the absolutely positioned highlight-divs are not repositioned when the window is resized.

Digging into the annotation module in Readium I saw that the code for redrawing the highlight divs is available in the redraw()-method, it's just never called. This patch solves the problem in the cloud reader, but I'm not sure if calling redrawHighlights from js/views/reader_view.js:handleViewportResize() is enough.

Any help would be appreciated!

Jan

@danielweck
Copy link
Member

@jccr @dmitrym0 I seem to remember you guys have a pretty good understanding of the execution flow for selection highlights (semi-transparent overlay divs). Could you please check @jansc suggested fix? Many thanks!

@jccr
Copy link
Contributor

jccr commented Mar 24, 2015

Hi, sorry I just got a chance to look at this now..
@jansc Thanks for this PR. Calling it on reader_view:handleViewportResize() is not enough, you are right.

I would much rather like exposing this redrawHighlights as a public function in reader_view, so then who ever needs to use it, they can call it from a PAGINATION_CHANGED event callback or manually when needed. Calling it when this event triggers should cover all cases when they should be redrawn.

@jansc
Copy link
Contributor Author

jansc commented Apr 16, 2015

Thanks for the feedback and sorry for the late answer. I'll update this pull request soon with redrawHighlights() as a public function in reader_view.

@jansc
Copy link
Contributor Author

jansc commented Jun 3, 2015

I'm sorry it took so long to implement your suggestions, but now I've committed an update. If I got you right, the new reader_view.redrawHightlights() function is not to be called in reader_views PAGINATION_CHANGED callback but somewhere else, e.g. in readium-js-viewer's PAGINATION_CHANGED callback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants