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

Hover circle misplaced on a radio button when zooming to 1000% level #12239

Open
bogdanmaris opened this issue Aug 18, 2020 · 6 comments
Open

Comments

@bogdanmaris
Copy link

bogdanmaris commented Aug 18, 2020

Affected versions

  • 81.0a1 (2020-08-18)

Affected platforms

  • Windows 10 64bit
  • Ubuntu 18.04 64bit
  • macOS 10.15

Steps to reproduce
pdfjs.renderInteractiveForms - true

  1. Launch Firefox
  2. Access a PDF form with fillable content (eg: https://pdf.ninja/interactiveform_enabled.pdf)
  3. Scroll down to the radio buttons
  4. Zoom to level 1000%
  5. Hover over the radio button

Expected result

  • Hover circle is within the borders of the radio button

Actual result

  • Hover circle is misplaced a bit when zoomed in

Additional notes

  • S4 as suggested severity, only noticeable when zooming to 1000%.
  • Here is a .gif showing the issue:

Radio Button zoom

@timvandermeij
Copy link
Contributor

Note that this also applies to checkboxes as the PR above suggests.

@serdnab
Copy link
Contributor

serdnab commented Sep 4, 2021

I am interested in fixing this.
The problem is the rounding here.
When the canvas has more rounded pixels than the canvas style or vice versa, misalignment occurs.
Why is it necessary for the canvas and canvas style to be multiples of the approximation of
fractions
and not just an integer?
Rounding to just an integer fixes the problem.

@Snuffleupagus
Copy link
Collaborator

Snuffleupagus commented Sep 4, 2021

The problem is the rounding here.

Unfortunately I believe that that's most likely a red herring, since the thing that becomes slightly wrong when CSS-only zooming is being used is probably the annotationLayer-positioning and not necessarily the canvas itself (since it works just fine if "regular" zooming is force-enabled, even at very large values).

Why is it necessary for the canvas and canvas style to be multiples of the approximation of fractions and not just an integer?

Please refer to PR #6552; basically it's necessary to avoid issues/glitches on HiDPI screens. Hence removing that would very likely re-introduce other issues, and again it's probably not the actual underlying issue here unfortunately.

@serdnab
Copy link
Contributor

serdnab commented Sep 5, 2021

How do you force-enable regular zooming?

@Snuffleupagus
Copy link
Collaborator

How do you force-enable regular zooming?

You'd have to increase the maxCanvasPixels option, however that's probably not entirely relevant here (since this issue just concerns the CSS-only zooming mode).
Thinking about this some more, I suppose that another possible cause of the bug could be that the PDFPageView.cssTransform-method in particular isn't placing the canvas entirely correct (e.g. not handling fractional widths/heights correctly). However, in order to fix this issue I think that the very first step is to figure out exactly why the canvas/annotationLayer positions differ specifically when CSS-only zooming is being used.

@serdnab
Copy link
Contributor

serdnab commented Sep 5, 2021

When you open the file at 600% zoom, before applying any zoom, don't you see a misalignment?

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

No branches or pull requests

4 participants