Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#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:
Blocked by: Blocking:

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;

Change History (4)

comment:1 Changed 11 years ago by rdworth

Milestone: 1.7.11.8

comment:2 Changed 11 years ago by rdworth

Resolution: duplicate
Status: newclosed

This patch is for #4199

comment:3 Changed 11 years ago by rdworth

Version: 1.71.7.1

comment:4 Changed 11 years ago by rdworth

Milestone: 1.81.7.1
Version: 1.7.11.7
Note: See TracTickets for help on using tickets.