espresso3389 / pdfrx

pdfrx is yet another PDF viewer implementation that built on the top of pdfium. The plugin currently supports Android, iOS, Windows, macOS, Linux, and Web.
MIT License
62 stars 38 forks source link

Zoom in/out bug with PDF in landscape #69

Closed chriswg3 closed 3 months ago

chriswg3 commented 3 months ago

When i display a PDF in landscape the InteractiveViewer does not allow to zoom to the minimum. I think this is becaus the bounderyMargin setting of the InteractiveViewer.

if I set it to:

iv.InteractiveViewer( transformationController: _txController, constrained: false, boundaryMargin: const EdgeInsets.all(double.infinity),

the zoom in / out works like it should.

Would be fine to have an option to set this parameter from outside.

espresso3389 commented 3 months ago

Could you explain me more about your problem?

I think the behavior is fine even with single page landscale PDF:

image

chriswg3 commented 3 months ago

You can see the problem if you try it on android and zoom in and out...

espresso3389 commented 3 months ago

Could you explain more? I'm not sure what's your problem.

espresso3389 commented 3 months ago

Actually, I've found an issue on PdfPageAnchor behavior and fixed it. But it has nothing to do with bounderyMargin:

https://github.com/espresso3389/pdfrx/blob/bae7c2f5205b591d0b7206aa6d8e9ffdf0ca98c3/lib/src/widgets/pdf_viewer.dart#L939-L982

chriswg3 commented 3 months ago

Look here:

https://github.com/espresso3389/pdfrx/assets/120425754/c3745f77-8b55-4fe1-a902-77bd2c6123df

espresso3389 commented 3 months ago

Oh, I see.

espresso3389 commented 3 months ago

0.4.44 fixes the issue; PdfViewerParams.boundaryMargin is working again and the new default is EdgeInsets.all(double.infinity).

By the way, I could not remember why I've removed boundaryMargin parameter from the code.

chriswg3 commented 3 months ago

You are using the parameter on several other places, are you sure that everything is ok then? Maybe you removed the parameter because of another bug?

espresso3389 commented 3 months ago

I think boundaryMargin should be there anyway. I had been just dropped mistakenly in some recent version.