-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Allow cropper to grow vertically #350
Comments
I think you can set the container's size base on the image's size before start a cropper. |
@fengyuanchen Yes. However some people might want to avoid the Also, that only applies when you first load the cropper. If you use |
I also ended up with my cropper recently unexpectedly working different. Which makes me think that it is much better for cropper to be responsible for sizes of things instead of relying on a context that allows potential race conditions and/or browser inconsistencies. |
After a few tests, I found this is a bug of the |
I'd like to have my (non-zoomable) cropper grow to fit the image (possibly up to a maximum size based on the viewport).
Like so.
This sort of works fine if the image is visible before Cropper is loaded. As it uses the container height that has been extended by the visible image as a base.
However if the image was
display: none;
ed such as by react-cropper or simply by someone not wanting to show an unstyled flash of the image without the cropper. This happens.I think the ideal would be to have an option like
growContainerVertical: true
(and perhaps amaxContainerHeight
). This way not only would it handle images that have been hidden, but it would also allow the height of the container to be recalculatedAs an extra possibility perhaps
maxContainerHeight
could be permitted to be a function. In which case it would be re-run when Cropper's _resize handler is triggered.The text was updated successfully, but these errors were encountered: