Skip to content

Resizable: correct aspectRatio handling with min/max dimensions - Fixed #4951 #295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 13 commits into from
Closed

Resizable: correct aspectRatio handling with min/max dimensions - Fixed #4951 #295

wants to merge 13 commits into from

Conversation

jfremy
Copy link

@jfremy jfremy commented May 16, 2011

This patch fixes an incorrect behavior when trying to maintain the aspect ratio with min/max width/height.
It does so by computing the dimensions of a "virtual box" that abides by the min/max width/height but at the same time follows the aspect ratio constraint.

The virtual boundaries are computed inside the _updateVirtualBoundaries method.
I also fixed two bugs in the _updateRatio method.

  1. The if(data.height) test would fail if data.height was 0 (0 == false in js ...). So I use an IsNumber test instead
  2. The corresponding dimension was computed by using csize instead of data
    Finally, I updated _respectSize to use the "virtual boundaries" rather than the min/max width/height set in the options (in normal cases, the virtual boundaries will correspond to min/max width/height)

The resizable unit tests on FF4.0 / Chrome 11 now pass 128 tests out of 137 (it's not failing any unit test related to preserve aspect anymore). The fix is purely algorithmic so that should work on other browsers as well.

If there is anything wrong in the coding style, please let me know. I'll update

@scottgonzalez
Copy link
Member

Thanks, landed in 981e969. Please clean up your repo so you can send clean pull requests.

@jfremy
Copy link
Author

jfremy commented May 27, 2011

Do you have any pointer to a page explaining how to clean-up my repo?

thanks!

@scottgonzalez
Copy link
Member

The following should work:

add upstream remote
If you already have the main repo as a remote, skip this step

git remote add upstream https://github.com/jquery/jquery-ui.git

get the latest content from upstream master

git fetch upstream master

reset your local master

git reset --hard upstream/master

push your master to GitHub
Note that you must force the push because you will be losing history from the reset.

git push --force origin master

Then do all future work in branches. Create a separate branch for each fix and send a pull request from the branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants