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

Add an option to never zoom larger than the original image size #2130

Open
JPustkuchen opened this issue Nov 11, 2024 · 0 comments
Open

Add an option to never zoom larger than the original image size #2130

JPustkuchen opened this issue Nov 11, 2024 · 0 comments

Comments

@JPustkuchen
Copy link
Contributor

JPustkuchen commented Nov 11, 2024

First, let me say "thank you" very much for this wonderful library!!

I think there might be a similar issue or request in the list of issues, I tried to find a matching one, but wasn't really successful. We're experiencing the following:

Context:
Clicking on a photoswipe image that use one of the available string view modes:

  • fit
  • fill

Problem:
When using photoswipe on an image that is for example 800x800px and using the "fit" option, zooming works perfectly on smaller screens, e.g. Smartphones. The image fits the viewport and is not shown larger than its original size.
Having a larger, e.g. desktop screen, the image is also zoomed to the boundaries, but for that reason zoomed larger than the image is and therefore becomes blurry!

Setting the zoom level to a hard value like "1" also isn't a solution because then the image is zoomed in heavily depending on the screen size.

The logic would be: Fit the screen, but do not display the image larger than it is!

Proposed solution:
While though custom code and a callback function one could solve this on your own, it would be very handy to have a predefined zoom level string to ensure this is not zoomed larger than the original image initially.

Additionally or as alternative, a boolean option to prevent overscale could be added, so that users can not zoom larger than the original image size.

What do you think?

Of course, we'd be willing to help to implement this, if you like this, and we can make a plan together!

Reproduction:
You can see this in the demos.

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

No branches or pull requests

1 participant