Ticket #4349 (closed bug: duplicate)
Resizable with Containment Aspect Ratio Bug (Includes patching instructions)
| Reported by: | garside | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 1.7.1 |
| Component: | ui.resizable | Version: | 1.7 |
| Keywords: | aspectratio containment | Cc: | |
| Blocking: | Blocked by: |
Description
In the current build of the jQuery UI Resizable widget, there is a bug which incorrectly allows an element with both aspectRatio restriction and a containment element to continue to expand past the aspect ratio once one edge of the element hits the border of its container.
I was able to determine the bug and patch it out. The bug exists in 3 places:
Line 678 - 680
var self = $(this).data("resizable"), o = self.options,
ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position,
pRatio = o._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement;
o._aspectRatio is always undefined. The actual setting it's looking for is a property of "self". Line 680 should look like:
pRatio = self._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement;
Line 709
if (pRatio) self.size.height = self.size.width / o.aspectRatio;
Line 714
if (pRatio) self.size.width = self.size.height * o.aspectRatio;
on both lines, o.aspectRatio refers to the boolean value for determining if the aspect ratio should be enforced or not. The actual setting it's looking for is a property of "self". Lines 709 and 714 should look like:
Line 709
if (pRatio) self.size.height = self.size.width / self.aspectRatio;
Line 714
if (pRatio) self.size.width = self.size.height * self.aspectRatio;

