marclundgren/alloy-ui — pull request #24 by mjbradford89 (2014-05-15 15:38:00+00:00)
Title: AUI-1323 - Image Cropper resizes height when dragging only width on first load and after zoom

Hi Marc,

I was hoping you could help me out by taking a look at my fix for this alloy issue(s) https://issues.liferay.com/browse/AUI-1323, which causes this portal issue(s) https://issues.liferay.com/browse/LPS-28621.

It seemed to me there were a variety of issues in the image cropper that was causing some strange behavior.

1. Sometimes the cropNode was escaping the resize/drag constraints, which was causing the cropNode to not be able to be resized until it was dragged away from the edge. I tweaked the math a bit to try and keep that from happening, and also have _constrainValues() called on each drag/resize event.

2. Coordinates were sometimes being rounded off by A.Lang.toInt. Which I think was the cause of the first issue in AUI-1323. I switched it to use toFloat to prevent rounding.

3. Changed the crop node size calculation from .width()/.height() to .get('offsetWidth')/.get('offsetHeight'). It seemed like the results were more accurate when the page was zoomed in or out.

Please let me know if you can reproduce these issues and if my changes resolve them.

Thanks!