timmywil / panzoom

A library for panning and zooming elements using CSS transforms :mag:
https://timmywil.com/panzoom/
MIT License
2.14k stars 416 forks source link

feat: new aspectfit contain mode #659

Closed farfromrefug closed 10 months ago

farfromrefug commented 10 months ago

this creates a new contain mode which is kind of a mix of outside and inside. You can zoom out to see the full view while blocking the panning while zoomed in to the bounds of the view

timmywil commented 10 months ago

Thanks for contributing! Please open an issue first explaining the feature and its main use cases. Then, any future PR will need to add tests.

pangxieju commented 8 months ago

inside can only satisfy when the content is smaller than the area. outside can only satisfy when the content is larger than the area. When the content starts smaller than the area and becomes larger after zooming, inside and outside cannot fulfill the requirement; there will also be a problem of content exceeding the area and unable to zoom in or out. aspectfit precisely solves this problem. Apart from aspectfit, are there any other methods to achieve this? Thank you.