Closed piotrze closed 9 years ago
Thanks for the PR!
I definitely like the idea, but there's more subtlety than what's addressed here. One issue is, when the image is rotated, we need an option similar to the current minZoom
that determines whether the image has to cover the entire preview area, which in turn affects how much the image may be rotated. I also don't quite like calculating the rotation on a canvas, mainly for performance issues. There is an obvious lag, especially in the case of large images, after each rotation. CSS transform might be a better option.
Good start overall. I'd appreciate it if you'd like to keep working on it, but it's ok otherwise.
I've added rotate() method to a plugin. For now there is only option to call it from api.
When you rotate image it replace existing image with new dataURL that includes rotated image. After rotation image is simply loaded again.
Rotation algorithm gracefully borrowed from https://github.com/fengyuanchen/cropper plugin.