FlowingCode / ImageCrop

An image cropping component wrapping https://www.npmjs.com/package/react-image-crop
Apache License 2.0
0 stars 0 forks source link

Aspect ratio 16/9 is not rectangular #4

Closed hariyogi closed 2 days ago

hariyogi commented 1 week ago

Describe the bug

If we set the aspect to 16/9, the resulting area is still square, not rectangular. However, if we set it to 1.777777777777777, the result will be rectangular.

Expected behavior

Aspect 16 / 9 should create a rectangular crop area.

Minimal reproducible example

Image image = new Image("images/my-image.png", "image to crop");
ImageCrop imageCrop = new ImageCrop(image ); imageCrop.setAspect(16/9); add(imageCrop);

Add-on Version

1.0.0

Vaadin Version

24.4.12

Additional information

No response

javier-godoy commented 1 week ago

Hello. Integer division in Java yields an integer result. Please use setAspect(16.0/9)

javier-godoy commented 2 days ago

Based on your reaction, it seems our response was helpful, so we're closing this issue. If you have any further questions, feel free to reopen it or create a new one.