Skip to content

Navigation Menu

Sign in
Sign up

Fix annotation layer misalignment issue - #256

Open
kevin-lynch wants to merge 1 commit into
FranckFreiburger:master from
kevin-lynch:master
Open

Fix annotation layer misalignment issue #256
kevin-lynch wants to merge 1 commit into
FranckFreiburger:master from
kevin-lynch:master

Conversation

@kevin-lynch

@kevin-lynch kevin-lynch commented Oct 8, 2020
edited
Loading

Copy link
Copy Markdown

Set ratio to 1. Any other value causes unexpected alignment issues of the annotation layer, specifically some instances in windows 10 google chrome. Tested on multiple devices, this fix has no issues.

Comment thread src/pdfjsWrapper.js
var pageRotate = (pdfPage.rotate === undefined ? 0 : pdfPage.rotate) + (rotate === undefined ? 0 : rotate);

var scale = canvasElt.offsetWidth / pdfPage.getViewport({ scale: 1 }).width * (window.devicePixelRatio || 1);
var scale = canvasElt.offsetWidth / pdfPage.getViewport({ scale: 1 }).width * 1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It's probably not going to be merged as the owner doesn't seem to be active on this package.

However, there is no point to multiply by 1, if window.devicePixelRatio is creating problems you might just remove the multiplication.

so instead of * 1 you just write:

var scale = canvasElt.offsetWidth / pdfPage.getViewport({ scale: 1 }).width

@kevin-lynch kevin-lynch Sep 16, 2021

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for your input. I did try this originally and it didn't always fix the issue in some edge cases. 1 is the second condition, it multiplies by window.devicePixelRatio if the relevant condition is met.

Copy link
Copy Markdown

@FranckFreiburger would be really great if this issue would be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@dvago dvago dvago requested changes
Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /