Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#4217 closed bug (fixed)

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 14 years ago.

Download all attachments as: .zip

Change History (4)

Changed 14 years ago by raziel057

Attachment: resizable.PNG added

comment:1 Changed 14 years ago by raziel057

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 );
...
}

comment:2 Changed 14 years ago by rdworth

Resolution: fixed
Status: newclosed

Fixed in r2162

Note: See TracTickets for help on using tickets.