MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2
https://aka.ms/webview2
454 stars 55 forks source link

[Problem/Bug]: zooming PDF behaves strangely; never resets to original zoom and keeps zooming out further each time #4758

Open pushkin- opened 3 months ago

pushkin- commented 3 months ago

What happened?

Will try to get a minimal example if helpful, but I"m seeing weird zooming behaviors with PDFs.

When IsZoomControlEnabled is false, ctrl+scroll will scroll a window with a PDF. So when it's true, there seems to be a double zoom happening. (sort of)

In my case, the setting is true, and if I log the ZoomFactor in the ZoomFactorChanged event, and I zoom in and out several times (one time per zoom in and out), I get logs like this:

0.9309927360774818 1.1637409200968523 0.8728056900726392 1.091007112590799 0.8182553344430992 1.022819168053874 0.7671143760404056 0.9588929700505069 0.7191697275378801 0.8989621594223501 0.6742216195667626 0.8427770244584533 0.6320827683438399 0.7901034604297998 0.5925775953223499 0.7407219941529374 0.555541495614703

notice it keeps decreasing slightly each time

If I use the +/- buttons embedded in the PDF, I don't have this issue.

tested with this PDF: https://warnell.uga.edu/sites/default/files/inline-files/ieVeg.pdf

Additionally, just opening the window triggers a ZoomFactorChanged event (with a zoom factor of 0.93; the first line in the list above)

With a window to a non-PDF (google.com), I get more predictable results:

1.1 1 1.1 1 1.1 1

Importance

Moderate. My app's user experience is affected, but still usable.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

127.0.2651.105

SDK Version

1.0.2535.41

Framework

Winforms

Operating System

Windows 11

OS Version

22631.4037

Repro steps

window.open window to PDF (I actually have some custom handling of NewWindowRequestedHandler and create my own WinForm with a WebView2 control in it)

Ctrl+Scroll to zoom in and out

PDF never resets to original zoom level and keeps zooming out bit by bit

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

No response

victorhuangwq commented 3 months ago

I was able to replicate this issue on the Edge Browser actually - and I'm also uncertain if this is a bug or an intended behavior.

I.e. if I use Ctrl+Scroll to zoom in and out on a PDF, it does not have a predictable zoom delta.