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

Annotation does not scale on zooming after resize #15571

Closed
shivaprsd opened this issue Oct 13, 2022 · 7 comments · Fixed by #15578
Closed

Annotation does not scale on zooming after resize #15571

shivaprsd opened this issue Oct 13, 2022 · 7 comments · Fixed by #15578
Assignees
Labels

Comments

@shivaprsd
Copy link

Attach (recommended) or Link to PDF file here: Any

Configuration:

  • Web browser and its version: Firefox 105.0.3
  • Operating system and its version: macOS 11.6
  • PDF.js version: 3.0.206 (latest demo)
  • Is a browser extension: no

Steps to reproduce the problem:

  1. Draw some annotation
  2. Resize it using the handle
  3. Zoom the viewer in/out

What is the expected behavior? (add screenshot)
The annotation should scale with the page.

What went wrong? (add screenshot)
Did not scale.

zoom-annot

Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension): N/A

@calixteman
Copy link
Contributor

Interesting bug...
I can reproduce it Firefox nightly on mac but not on Windows.

@shivaprsd
Copy link
Author

shivaprsd commented Oct 13, 2022

I can reproduce it also while zooming when the last annotation is uncommitted. One has to use Cmd/Ctrl +/- to see it, as clicking on the toolbar button commits the annotation before the zoom happens.

zoom-annot-2
Edit: added screenshot.

@calixteman calixteman self-assigned this Oct 15, 2022
@calixteman
Copy link
Contributor

The dimensions of an added ink annotation are in % and when it's resized (in using the resizer) the dimensions are of course modified but in px.
The ResizeObserver is calling setDimensions, but the dimensions of the div aren't only changed in regard of some conditions:

this.setDims(width, height);

Consequently, from time to time, the div has some dimensions in px instead of % and finally it isn't correctly rescaled on zoom change.

@calixteman
Copy link
Contributor

I filed a bug in Firefox:
https://bugzilla.mozilla.org/show_bug.cgi?id=1795536

@shivaprsd
Copy link
Author

@calixteman The patch does fix the bug of the first kind, but it still does not fix the second one. Are they both due to bug 1795536? But it seems to be an edge case to add too many workarounds.. anyway, my 2c.

@calixteman
Copy link
Contributor

@shivaprsd, I missed the second issue.
It's better to have a filed bug by issue.
Anyway I can reproduce on Windows 11.

@shivaprsd
Copy link
Author

@calixteman I thought both were due to the same bug, so did not want to open a duplicate issue. Good that you found the causes.

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