fengyuanchen / cropper

⚠️ [Deprecated] No longer maintained, please use https://github.com/fengyuanchen/jquery-cropper
MIT License
7.75k stars 1.74k forks source link

Cropped image is shifted related to the selection #969

Closed lexiv0re closed 6 years ago

lexiv0re commented 6 years ago

Hi @fengyuanchen! First of all, thanks for the cropper.

Was testing in https://fengyuanchen.github.io/photo-editor/: Selecting selection results in result which is cut on the right and bottom sides.

The cropped area is very small (about 16x16px) so probably it's a rounding issue?

Source image: shifts

fengyuanchen commented 6 years ago

All decimals will be ignored (floored) when apply to canvas element to crop. It is the default behaviour of canvas element.

lexiv0re commented 6 years ago

Are there any good known workarounds for this? Maybe there is a way to apply some restrictions to crop area to prevent this?

fengyuanchen commented 6 years ago

Maybe send both the data and image to server to crop it.

lexiv0re commented 6 years ago

Yes, that's an option. Is it possible to show preview container (not the crop area) with the rounding already applied? If not, do you have an idea if it will be hard to apply such an enhancement?

fengyuanchen commented 6 years ago

You can fork one and try to round all size related values for your expectation if you have interest.