Skip to main content

Search and Top Navigation

#4217 closed bug (fixed)

Opened February 23, 2009 04:28PM UTC

Closed March 02, 2009 10:12AM UTC

Last modified January 17, 2010 06:02AM UTC

Resizable: displacement of element (in case of constraint resize area) - BUG FIX supplied !

Reported by: raziel057 Owned by:
Priority: major Milestone: 1.7
Component: ui.resizable Version: 1.6rc6
Keywords: resiazable containment Cc:
Blocked by: Blocking:
Description

when I set an element resizable with containment: 'parent' and the element is near to the right border of the parent, it moves when resizing quickly using left handle. (It's the same when you resize by using top handle and item is near to bottom border).

In fact I noticed the problem comes from :

$.ui.plugin.add("resizable", "containment",

...

resize: function(event, ui) {

...

var woset = Math.abs( (self._helper ? self.offset.left - cop.left : (self.offset.left - cop.left)) + self.sizeDiff.width ),

hoset = Math.abs( (self._helper ? self.offset.top - cop.top : (self.offset.top - co.top)) + self.sizeDiff.height );

self.offset.left and self.offset.top do not always contains the correct values.

So I suggest you to set the correct values before to initialize woset/hoset by inserting the following lines:

self.offset.left = self.parentData.left+self.position.left;

self.offset.top = self.parentData.top+self.position.top;

I made some tests under IE6, FF3 and Chrome and seems to works well.

Attachments (1)
  • resizable.PNG (5.5 KB) - added by raziel057 February 23, 2009 04:29PM UTC.
Change History (3)

Changed February 27, 2009 11:02PM UTC by raziel057 comment:1

As result, the bug fix constist in addition of the two lines :

self.offset.left = self.parentData.left+self.position.left;

self.offset.top = self.parentData.top+self.position.top;

In the code:

$.ui.plugin.add("resizable", "containment",
...
resize: function(event, ui) {
...
// START BUG FIX
self.offset.left = self.parentData.left+self.position.left;
self.offset.top = self.parentData.top+self.position.top;
// END BUG FIX

var woset = Math.abs( (self._helper ? self.offset.left - cop.left : (self.offset.left - cop.left)) + self.sizeDiff.width ),
    hoset = Math.abs( (self._helper ? self.offset.top - cop.top : (self.offset.top - co.top)) + self.sizeDiff.height );
...
}

Changed March 02, 2009 10:12AM UTC by rdworth comment:2

resolution: → fixed
status: newclosed

Fixed in r2162