Fix for selection off by 1px#24
Conversation
|
Thanks, Timo, for your work! At the moment I'm staying abroad so I will be
|
Fix for selection off by 1px
|
Hey, I returned from my holiday and immediately checked your pull request. Thank you for fixing this annoying bug! I have already performed the release 0.5.4, updated ApiDocs. It will appear in Maven Central repo shortly. Thank you! |
|
The Gwt-Cropper 0.5.4 is released in Maven Central repository. Thank you for contribution! |
|
Hello Guys, looks we have problem with selection boundaries in this release, issue: #25 |
Currently, it's possible to create a selection that extends across the borders of the canvas by one pixel. See attached screenshot of the official demo below, where the image to be cropped is 600x398px and the selection is 601x399px, which shouldn't be possible.
Also,
getSelectionXCoordinate()basically returnsnInnerX + SELECTION_BORDER_SIZE, butsetInitialSelection(...)doesn't takeSELECTION_BORDER_SIZEinto account. So, when you e.g. create a selection that covers the whole image and later open the cropper again setting the initial selection, the coordinates are deemed wrong by the cropper and it will reset the selection.While trying to fix this, I found that the code introduced for issue #18 makes it quite complicated to get this right. That's why in this pull request, the internal coordinates are made zero based again and a different approach is taken to compensate for the border width.