-
Notifications
You must be signed in to change notification settings - Fork 128
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
new-image-drawn event not fired when image added with chooseFile() method #124
Comments
I tried the demo and the event was fired. I record the screen: https://www.useloom.com/share/d88cec876178418a8647adbcca24c108 |
Load one and then use the chooseFile() to load another. Only fires on the first load. https://www.useloom.com/share/effcb66e92854f118d4d1f460c6e0d7c My use case is a profile image. The user may already have a profile image and may choose to edit the existing image OR replace it with a new one. In this case I pass an initial image prop and so I must display a button with chooseFile(). Since an initial image is loaded on init adding a replacement image does not fire the new-image-drawn event. Try for yourself with the same codepen. The work around is to remove() the initial image before the second one is added. The problem here is if the user cancels the file input there is no way to capture that event and replace the initial image. |
@rwfresh Indeed. Will fix the bug. Please use |
@zhanziyang Thank you very much for making this component. I really appreciate it. I went through the code to see if I could modify and make a pull request but I haven't had enough time to actually track it down. |
Also, might be of value for other users, I have a demo where I place an overlay that helps end users frame their image much like linkedIn's profile image editor. This fix will make it run much smoother. I will create a codepen demo. |
@rwfresh Sounds awesome! |
@rwfresh Bug fixed in new version 1.3.7. Please upgrade : ) |
Hi @zhanziyang Thanks for this fix. Finally had a chance to review my code. Here's a codepen with the overlay I was talking about. https://codepen.io/rwfresh/pen/zLYQVz |
@zhanziyang right on. Again, thanks to you for taking the time to put this together. |
@zhanziyang , it seems not update in demo. |
When adding a new image to a croppa instance using the chooseFile() method the new-image-drawn event is not fired.
https://codepen.io/anon/pen/zLYQVz
Not necessarily a bug as you can force hasImage() to false by using remove() before the new image is selected which will result in the event being emitted.
In my case I'd like to replace the existing image and still have the event fired so that the new image will be sized correctly according to my initial-size prop value
The text was updated successfully, but these errors were encountered: