Skip to content
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

Resizable: modified resizable containment plugin to restrict resizing within container. Fixes #7018 Resizable: resizing can move objects #1122

Closed
wants to merge 2 commits into from

Conversation

dekajp
Copy link
Contributor

@dekajp dekajp commented Oct 29, 2013

Fixes #9107 Resizable: aspectRatio and containment not handled correctly
Fixes #7018 Resizable: resizing can move objects

Just want to check if this approach is ok ? for fiddle link - http://jsfiddle.net/dekajp/c2Rux/14/

adding prevSize and prevPosition in the plugin parameter object. so that if resize breaks then it can be restored.

this PR is not complete - does not include unit testing. ( Fixes #7018 ). also i found some minor code style issues , so i fixed them.

@mikesherov
Copy link
Member

The approach seems fine to me. I have some minor nits, which I'll report now just to avoid saying them later:

  1. A lot of the comments you're fixing are unnecessary to begin with. Rather than fix them, remove them if they don't mention a ticket number or a browser they're supporting. If they do mention a browser, please augment the comment to include a line: // support: IE. There a lots of examples in the code base.
  2. Your style of declaring an empty object and then assigning individual properties should be replaced with a single declaration with the properties defined during the declaration.

@dekajp
Copy link
Contributor Author

dekajp commented Oct 31, 2013

@mikesherov added unit test cases and your suggested changes.

@@ -123,6 +123,27 @@ test("aspectRatio: 'preserve' (ne)", function() {
equal( target.height(), 70, "compare minHeight");
});

test( "aspectRatio: ticket-7018", function() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ticket-7018 -> #7018

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should avoid ticket references in unit tests. Describe what the test is about instead, like all other tests do.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The test name should be descriptive of the test. Ticket references should be in comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a good name aspectRatio:position ? i am very bad in naming variables

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was under the impression that test names should reference ticket number along with good description. I thought we were just getting rid of *_tickets.js. It's helpful to see the ticket number in the runner output.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with that, as long as the test name is descriptive. I just don't think the fact that a ticket existed is actually important in the output.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scottgonzalez I'm fine either way, but I do personally think the fact that a ticket existed is important, I always look back at fiddles.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed ticket ref from test output, but added #ticket as comment in code.

@mikesherov
Copy link
Member

@dekajp, thanks again for all your hard work! I did a review and once you make those minor changes, I can land this!

@dekajp
Copy link
Contributor Author

dekajp commented Oct 31, 2013

@mikesherov thank you !! whats your preference - do you want me to push new changes in separate commit or you want me to update original commit ?

@mikesherov
Copy link
Member

@dekajp single updated commit is preferred.

… within container. Fixes #7018 Resizable: resizing can move objects
@dekajp
Copy link
Contributor Author

dekajp commented Nov 4, 2013

@mikesherov seems http://bugs.jqueryui.com/ticket/9107 is related to this . here is the fixed fiddle -http://jsfiddle.net/Mm2Ed/3/ ( minor change - continueResize=false in re calculation of left and top coord.

do you want me to add this change in this commit or i can submit a new PR based on this .

@mikesherov
Copy link
Member

Add it to this, but edit the commit message. Thanks again for all your hard work!

@dekajp
Copy link
Contributor Author

dekajp commented Nov 5, 2013

I am trying to add a test case - example in fiddle (http://jsfiddle.net/c2Rux/16/) it seems that i can not simulate this

the last drag [-10,-10] does not work !!
jqueryui

@dekajp
Copy link
Contributor Author

dekajp commented Nov 5, 2013

ah !! i think i got the problem , i created some room for mouse move by making the container absolute left:100 ,top:100 after that it worked

… within container. Fixes #7018 Resizable: resizing can move objects and Fixes #9107 Resizable: aspectRatio and containment not handled correctly
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.

None yet

4 participants