Skip to content

Fix #9820 Thumbnail scale #12617

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

Closed

Conversation

YipingRuan
Copy link

@YipingRuan YipingRuan commented Nov 13, 2020

#9820

To reproduce the bug

  • Set monitor DPI/Scale beyond 100%
  • Thumbnails of pages out of view (not in the getVisibleElements from ui_utils.js)

image
image

@YipingRuan YipingRuan changed the title Fix #9820 Fix #9820 Thumbnail scale Nov 13, 2020
Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary though, since the use of getOutputScale in _getPageDrawContext should already handle things?
Can you please compare the PDFPageView and PDFThumbnailView implementations to figure out exactly where they differ? As-is, it's not entirely clear (at least to me) where the bug actually is and why the current solution is correct.

Finally, please remember to write a good commit message as well (only including information in the PR description isn't enough).

@YipingRuan
Copy link
Author

YipingRuan commented Nov 13, 2020

Apparently it was not handled and the thumbnails have wrong scale at high DPI.

My guess is in pdf_page_view.js it use:

const outputScale = getOutputScale(ctx);

Not the case for "PDFThumbnailView".

In fact I copy the window.devicePixelRatio from getOutputScale. Any other hint?

I will force push to include the commit message.

@Snuffleupagus
Copy link
Collaborator

My guess is in pdf_page_view.js it use:

const outputScale = getOutputScale(ctx);

Not the case for "PDFThumbnailView".

Huh, it's most definitely used there as well; please see

const outputScale = getOutputScale(ctx);

The question is why it's not working as-is, and looking at that method in detail I've got an idea for the actual underlying bug.

@YipingRuan
Copy link
Author

YipingRuan commented Nov 13, 2020

Ok great! Leave to expert then.

Other observation is "this.scale" here was always a fixed value, regardless of screen DPI.

const drawViewport = this.viewport.clone({ scale: this.scale });

@timvandermeij
Copy link
Contributor

timvandermeij commented Nov 13, 2020

It looks like PR #12618 will solve the underlying problem here, so let's close this one. Thanks.

@YipingRuan YipingRuan deleted the fix/#9820_thumbnail_scale branch November 14, 2020 02:16
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.

3 participants