Skip to main content

Search and Top Navigation

#4349 closed bug (duplicate)

Opened March 16, 2009 06:41PM UTC

Closed March 17, 2009 11:20AM UTC

Last modified March 22, 2009 12:45PM UTC

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;
Attachments (0)
Change History (4)

Changed March 16, 2009 11:02PM UTC by rdworth comment:1

milestone: 1.7.11.8

Changed March 17, 2009 11:20AM UTC by rdworth comment:2

resolution: → duplicate
status: newclosed

This patch is for #4199

Changed March 22, 2009 12:43PM UTC by rdworth comment:3

version: 1.71.7.1

Changed March 22, 2009 12:45PM UTC by rdworth comment:4

milestone: 1.81.7.1
version: 1.7.11.7