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

Prevent the annotationLayer from overflowing (PR 15036 follow-up) #15061

Closed

Conversation

Snuffleupagus
Copy link
Collaborator

After the changes in PR #15036, in some cases the annotationLayer may cause an empty area to appear after the last page; one example is f1040.pdf in the test-suite.
This patch simply does the same thing as we already do in the textLayer, that is simply hide any overflow.


overflow

After the changes in PR 15036, in some cases the annotationLayer may cause an empty area to appear after the last page; one example is `f1040.pdf` in the test-suite.
This patch simply does the same thing as we already do in the textLayer, that is simply hide any overflow.
…ollow-up)

Note how the "page"-div, "canvasWrapper"-div, and `textLayer`-div all have *integer* dimensions (rounded down) rather than using the "raw" viewport-dimensions.
Hence it seems reasonable that the same should apply to the "annotationLayer"-div, now that it's explicit dimensions set.
@calixteman
Copy link
Contributor

Is the overflow only due to the non-integer width/height ?

@Snuffleupagus
Copy link
Collaborator Author

Is the overflow only due to the non-integer width/height ?

Unfortunately not, at least in my testing. (The second patch only fixes an inconsistency.)

@calixteman
Copy link
Contributor

It's liekely because of:
font-size: calc(100px * var(--scale-factor));.

Maybe there is something in em which causes the overflow.

@Snuffleupagus
Copy link
Collaborator Author

Wait, setting overflow: hidden breaks PopupAnnotations since those need to overflow the container :-(

@calixteman
Copy link
Contributor

I set:
https://github.com/mozilla/pdf.js/blob/master/web/annotation_layer_builder.css#L44
in order to use font-sizewith a percentage.
But it appears that because of that every section is now overflowing, I don't really understand why...
Anyway as far as I can tell there are 2 ways to fix that:

  • add an overflow:hidden for sections;
  • remove the font-size as a percentage and use calc(....) instead.

We can either backout my patch or wait a little and I'll push something tomorrow.
Of course, please feel free to have a better idea than mines... ;)

@Snuffleupagus
Copy link
Collaborator Author

  • add an overflow:hidden for sections;

Unfortunately I don't believe that'll work, since in my quick testing that still breaks PopupAnnotations as mentioned in #15061 (comment).

@Snuffleupagus
Copy link
Collaborator Author

I'm going to close this, given PR #15064, however I intend to submit the second commit separately since that still makes sense for consistency in my opinion.

@Snuffleupagus Snuffleupagus deleted the annotationLayer-overflow branch June 20, 2022 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants