-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Cropper not responsive if only window height is changed #835
Comments
See the next line (Line 37): Lines 34 to 37 in daf4fb6
|
Also, you can call the internal |
Hello, thanks for the response It is true that it enters the code-path but as the ratio is based on the width - it is always 1 and therefore updating the canvas and cropbox data has no effect. Lines 49 to 54 in daf4fb6
I have tried it out with this code-snippet and with that it also keeps the crop-box aligned on vertical window changes
I have created this small repo for reproduction: https://github.com/bene-starzengruber/cropper-js-resize-demo
If the window width is changed, everything works as expected, if only the height is changed, the cropbox will loose its alignment. |
Good solution. |
@fengyuanchen do you have a plan when the next release will be so that this fix can land? |
@bene-starzengruber A new version (v1.5.12) has been released. |
Describe the bug
Even with
responsive
andrestore
options set totrue
, the cropper will not update itself if only the height of the window is changed.Expected behavior
The cropper should react both on width and height
Code
cropperjs/src/js/handlers.js
Line 34 in daf4fb6
The ratio will always be 1 if the user is changing only the height of the window.
In order to fix this, we would need to calculate both ratios for width and height and take the smaller one
The text was updated successfully, but these errors were encountered: