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

Feature: contain: 'outside', but allow the image to fit the container? #577

Closed
hillin opened this issue Jul 26, 2021 · 3 comments
Closed
Labels
feature votes needed Feature requests are closed at first, but will be implemented with enough upvotes

Comments

@hillin
Copy link

hillin commented Jul 26, 2021

It's a little bit difficult to describe, so I got no luck while looking for an existing issue. Sorry if this is a duplicate.

Basically, I'd like to have the outside contain mode, but allow the image to be zoomed out to fit in the container (like css object-fit: contain). The image is not allowed to be further zoomed out. When the image is smaller than the container, it should be center aligned both horizontally and vertically.

E.g. if the container is 100x100 px, the image is 400x200px, it can be zoomed out by a factor of 0.25, which makes its visual size 100x50 px. It will be as wide as the container, and vertically center-aligned.

@hillin hillin added the feature label Jul 26, 2021
@timmywil
Copy link
Owner

Thanks for opening an issue. This is sort of like contain: outside until the element reaches it's minimum amount, then turning off the contain option and just setting a maxScale that sizes the image equivalent to 100x50. It can be accomplished now, tho admittedly not as simply if there were some option that could accomplish this. That said, I'm not sure exactly what that option would look like. Maybe some kind of compliment to contain: outside that only enforces the contain for one axis.

Regardless, thank you for the suggestion and I'll go ahead and put this in the feature request pipeline.

@timmywil timmywil added the votes needed Feature requests are closed at first, but will be implemented with enough upvotes label Jul 26, 2021
@hillin
Copy link
Author

hillin commented Jul 27, 2021

Thanks. This is actually the default (and maybe the only) behavior of many image viewer apps, like the one integrated in Windows 10.

I'm thinking of adding a new contain mode contain: outside-fit, although I can imagine that the implementation will extend the scope of the contain option.

@mythjuha
Copy link

Sounds the same as #504

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature votes needed Feature requests are closed at first, but will be implemented with enough upvotes
Projects
None yet
Development

No branches or pull requests

3 participants